directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r658851 - in /directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core: ./ authn/ authz/ changelog/ collective/ enumeration/ exception/ jndi/
Date Wed, 21 May 2008 20:36:49 GMT
Author: akarasulu
Date: Wed May 21 13:36:48 2008
New Revision: 658851

URL: http://svn.apache.org/viewvc?rev=658851&view=rev
Log:
fixing compilation issues associated with NamingExceptions and NamingEnumerations

Added:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/JndiUtils.java
Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Wed May 21 13:36:48 2008
@@ -566,13 +566,13 @@
     }
 
 
-    public LdapContext getJndiContext() throws NamingException
+    public LdapContext getJndiContext() throws Exception
     {
         return this.getJndiContext( null, null, null, AuthenticationLevel.NONE.toString(), "" );
     }
 
 
-    public LdapContext getJndiContext( String dn ) throws NamingException
+    public LdapContext getJndiContext( String dn ) throws Exception
     {
         return this.getJndiContext( null, null, null, AuthenticationLevel.NONE.toString(), dn );
     }
@@ -591,7 +591,7 @@
 
 
     public synchronized LdapContext getJndiContext( LdapDN principalDn, String principal, byte[] credential,
-        String authentication, String rootDN ) throws NamingException
+        String authentication, String rootDN ) throws Exception
     {
         checkSecuritySettings( principal, credential, authentication );
 
@@ -961,7 +961,7 @@
      * @return true if the bootstrap entries had to be created, false otherwise
      * @throws javax.naming.NamingException if entries cannot be created
      */
-    private boolean createBootstrapEntries() throws NamingException
+    private boolean createBootstrapEntries() throws Exception
     {
         boolean firstStart = false;
         

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Wed May 21 13:36:48 2008
@@ -30,8 +30,8 @@
 import java.util.Set;
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 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.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -61,8 +61,6 @@
 import org.slf4j.LoggerFactory;
 
 import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 
 
 /**
@@ -94,7 +92,7 @@
     /**
      * Registers and initializes all {@link Authenticator}s to this service.
      */
-    public void init( DirectoryService directoryService ) throws NamingException
+    public void init( DirectoryService directoryService ) throws Exception
     {
 
         if ( authenticators == null )
@@ -153,9 +151,9 @@
      *
      * @param authenticator Authenticator to initialize and register by type
      * @param directoryService configuration info to supply to the Authenticator during initialization
-     * @throws javax.naming.NamingException if initialization fails.
+     * @throws javax.naming.Exception if initialization fails.
      */
-    private void register( Authenticator authenticator, DirectoryService directoryService ) throws NamingException
+    private void register( Authenticator authenticator, DirectoryService directoryService ) throws Exception
     {
         authenticator.init( directoryService );
 
@@ -191,7 +189,7 @@
     }
 
 
-    public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -205,7 +203,7 @@
     }
 
 
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -218,7 +216,7 @@
     }
 
 
-    public LdapDN getMatchedName( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws NamingException
+    public LdapDN getMatchedName( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -230,7 +228,7 @@
     }
 
 
-    public ServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws NamingException
+    public ServerEntry getRootDSE( NextInterceptor next, GetRootDSEOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -242,7 +240,7 @@
     }
 
 
-    public LdapDN getSuffix( NextInterceptor next, GetSuffixOperationContext opContext ) throws NamingException
+    public LdapDN getSuffix( NextInterceptor next, GetSuffixOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -254,7 +252,7 @@
     }
 
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws NamingException
+    public boolean hasEntry( NextInterceptor next, EntryOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -266,7 +264,7 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> list( NextInterceptor next, ListOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -278,7 +276,7 @@
     }
 
 
-    public Iterator<String> listSuffixes( NextInterceptor next, ListSuffixOperationContext opContext ) throws NamingException
+    public Iterator<String> listSuffixes( NextInterceptor next, ListSuffixOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -290,7 +288,7 @@
     }
 
 
-    public ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor next, LookupOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -325,7 +323,7 @@
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -338,7 +336,7 @@
     }
 
 
-    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
+    public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -354,7 +352,7 @@
 
 
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
-            throws NamingException
+            throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -370,7 +368,7 @@
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext opContext ) throws NamingException
+    public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -384,7 +382,7 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
     {
         if ( IS_DEBUG )
         {
@@ -396,7 +394,7 @@
     }
 
 
-    private void checkAuthenticated( MessageTypeEnum operation ) throws NamingException
+    private void checkAuthenticated( MessageTypeEnum operation ) throws Exception
     {
         try
         {
@@ -410,7 +408,7 @@
         }
     }
 
-    private void checkAuthenticated() throws NamingException
+    private void checkAuthenticated() throws Exception
     {
         ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
 
@@ -428,8 +426,7 @@
     }
 
 
-    public void bind( NextInterceptor next, BindOperationContext opContext )
-            throws NamingException
+    public void bind( NextInterceptor next, BindOperationContext opContext ) throws Exception
     {
         // The DN is always normalized here
         LdapDN normBindDn = opContext.getDn();

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Wed May 21 13:36:48 2008
@@ -20,16 +20,17 @@
 package org.apache.directory.server.core.authz;
 
 
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.authz.support.ACDFEngine;
+import org.apache.directory.server.core.cursor.Cursor;
 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.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -71,8 +72,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 
 import java.text.ParseException;
@@ -197,7 +196,7 @@
      * the tupe and group membership caches and the ACIItem parser and the ACDF engine.
      *
      * @param directoryService the directory service core
-     * @throws NamingException if there are problems during initialization
+     * @throws Exception if there are problems during initialization
      */
     public void init( DirectoryService directoryService ) throws Exception
     {
@@ -233,7 +232,7 @@
     }
 
 
-    private void protectCriticalEntries( LdapDN dn ) throws NamingException
+    private void protectCriticalEntries( LdapDN dn ) throws Exception
     {
         LdapDN principalDn = getPrincipal().getJndiName();
 
@@ -267,11 +266,11 @@
      * @param tuples the collection of tuples to add to
      * @param dn the normalized distinguished name of the protected entry
      * @param entry the target entry that access to is being controled
-     * @throws NamingException if there are problems accessing attribute values
+     * @throws Exception if there are problems accessing attribute values
      * @param proxy the partition nexus proxy object
      */
     private void addPerscriptiveAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn,
-        ServerEntry entry ) throws NamingException
+        ServerEntry entry ) throws Exception
     {
         EntryAttribute oc = entry.get( objectClassType );
         
@@ -312,9 +311,9 @@
      *
      * @param tuples the collection of tuples to add to
      * @param entry the target entry that access to is being regulated
-     * @throws NamingException if there are problems accessing attribute values
+     * @throws Exception if there are problems accessing attribute values
      */
-    private void addEntryAciTuples( Collection<ACITuple> tuples, ServerEntry entry ) throws NamingException
+    private void addEntryAciTuples( Collection<ACITuple> tuples, ServerEntry entry ) throws Exception
     {
         EntryAttribute entryAci = entry.get( entryAciType );
         
@@ -351,11 +350,11 @@
      * @param tuples the collection of tuples to add to
      * @param dn the normalized distinguished name of the protected entry
      * @param entry the target entry that access to is being regulated
-     * @throws NamingException if there are problems accessing attribute values
+     * @throws Exception if there are problems accessing attribute values
      * @param proxy the partition nexus proxy object
      */
     private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn, ServerEntry entry )
-        throws NamingException
+        throws Exception
     {
         // only perform this for subentries
         if ( !entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
@@ -425,7 +424,7 @@
      * -------------------------------------------------------------------------------
      */
 
-    public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
     {
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -502,7 +501,7 @@
     }
 
 
-    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws Exception
     {
     	LdapDN name = deleteContext.getDn();
     	
@@ -548,7 +547,7 @@
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -669,7 +668,7 @@
         groupCache.groupModified( name, mods, entry, registries );
     }
 
-    public boolean hasEntry( NextInterceptor next, EntryOperationContext entryContext ) throws NamingException
+    public boolean hasEntry( NextInterceptor next, EntryOperationContext entryContext ) throws Exception
     {
         LdapDN name = entryContext.getDn();
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -714,9 +713,9 @@
      * @param principal the user associated with the call
      * @param dn the name of the entry being looked up
      * @param entry the raw entry pulled from the nexus
-     * @throws NamingException if undlying access to the DIT fails
+     * @throws Exception if undlying access to the DIT fails
      */
-    private void checkLookupAccess( LdapPrincipal principal, LdapDN dn, ServerEntry entry ) throws NamingException
+    private void checkLookupAccess( LdapPrincipal principal, LdapDN dn, ServerEntry entry ) throws Exception
     {
         // no permissions checks on the RootDSE
         if ( dn.toString().trim().equals( "" ) )
@@ -760,7 +759,7 @@
     }
 
 
-    public ServerEntry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor next, LookupOperationContext lookupContext ) throws Exception
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
@@ -783,7 +782,7 @@
         return next.lookup( lookupContext );
     }
 
-    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
+    public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws Exception
     {
         LdapDN name = renameContext.getDn();
 
@@ -837,7 +836,7 @@
 
 
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext )
-        throws NamingException
+        throws Exception
     {
         LdapDN oriChildName = moveAndRenameContext.getDn();
         LdapDN newParentName = moveAndRenameContext.getParent();
@@ -918,7 +917,7 @@
     }
 
 
-    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws NamingException
+    public void move( NextInterceptor next, MoveOperationContext moveContext ) throws Exception
     {
         LdapDN oriChildName = moveContext.getDn();
         LdapDN newParentName = moveContext.getParent();
@@ -996,12 +995,12 @@
     }
 
     
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor next, ListOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> list( NextInterceptor next, ListOperationContext opContext ) throws Exception
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
         LdapPrincipal user = ctx.getPrincipal();
-        NamingEnumeration<ServerSearchResult> e = next.list( opContext );
+        Cursor<ServerEntry> e = next.list( opContext );
         
         if ( isPrincipalAnAdministrator( user.getJndiName() ) || !enabled )
         {
@@ -1009,17 +1008,19 @@
         }
         
         AuthorizationFilter authzFilter = new AuthorizationFilter();
-        return new SearchResultFilteringEnumeration( e, DEFAULT_SEARCH_CONTROLS, invocation, authzFilter, "List authorization Filter" );
+//        return new SearchResultFilteringEnumeration( e, DEFAULT_SEARCH_CONTROLS, invocation, authzFilter, "List authorization Filter" );
+        // TODO NotImplementedException
+        throw new NotImplementedException();
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> search( NextInterceptor next, SearchOperationContext opContext ) throws Exception
     {
         Invocation invocation = InvocationStack.getInstance().peek();
         ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
         LdapPrincipal user = ctx.getPrincipal();
         LdapDN principalDn = user.getJndiName();
-        NamingEnumeration<ServerSearchResult> e = next.search( opContext );
+        Cursor<ServerEntry> e = next.search( opContext );
 
         boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( opContext.getDn().getNormName() );
         SearchControls searchCtls = opContext.getSearchControls();
@@ -1031,7 +1032,9 @@
         }
         
         AuthorizationFilter authzFilter = new AuthorizationFilter();
-        return new SearchResultFilteringEnumeration( e, searchCtls, invocation, authzFilter, "Search authorization Filter" );
+//        return new SearchResultFilteringEnumeration( e, searchCtls, invocation, authzFilter, "Search authorization Filter" );
+        // TODO NotImplementedException
+        throw new NotImplementedException();
     }
 
     
@@ -1041,7 +1044,7 @@
     }
     
 
-    public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws NamingException
+    public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws Exception
     {
     	LdapDN name = opContext.getDn();
     	String oid = opContext.getOid();
@@ -1077,7 +1080,7 @@
     }
 
 
-    public LdapDN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws NamingException
+    public LdapDN getMatchedName ( NextInterceptor next, GetMatchedNameOperationContext opContext ) throws Exception
     {
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
@@ -1120,13 +1123,13 @@
     }
 
 
-    public void cacheNewGroup( LdapDN name, ServerEntry entry ) throws NamingException
+    public void cacheNewGroup( LdapDN name, ServerEntry entry ) throws Exception
     {
         groupCache.groupAdded( name, entry );
     }
 
 
-    private boolean filter( Invocation invocation, LdapDN normName, ServerSearchResult result ) throws NamingException
+    private boolean filter( Invocation invocation, LdapDN normName, ServerSearchResult result ) throws Exception
     {
         ServerEntry resultEntry = result.getServerEntry();
 
@@ -1246,8 +1249,8 @@
      */
     class AuthorizationFilter implements SearchResultFilter
     {
-        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
-            throws NamingException
+        public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls ) 
+            throws Exception
         {
             LdapDN normName = result.getDn().normalize( atRegistry.getNormalizerMapping() );
             return filter( invocation, normName, result );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Wed May 21 13:36:48 2008
@@ -20,12 +20,12 @@
 package org.apache.directory.server.core.authz;
 
 
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.ServerEntry;
 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;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -53,10 +53,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 import javax.naming.NoPermissionException;
-import javax.naming.directory.SearchControls;
 import javax.naming.ldap.LdapContext;
 import java.util.HashSet;
 import java.util.Map;
@@ -171,7 +168,7 @@
     //    Lookup, search and list operations need to be handled using a filter
     // and so we need access to the filter service.
 
-    public void delete( NextInterceptor nextInterceptor, DeleteOperationContext opContext ) throws NamingException
+    public void delete( NextInterceptor nextInterceptor, DeleteOperationContext opContext ) throws Exception
     {
     	LdapDN name = opContext.getDn();
     	
@@ -280,7 +277,7 @@
     }
 
 
-    private void protectModifyAlterations( LdapDN dn ) throws NamingException
+    private void protectModifyAlterations( LdapDN dn ) throws Exception
     {
         LdapDN principalDn = getPrincipal().getJndiName();
 
@@ -344,7 +341,7 @@
     // ------------------------------------------------------------------------
 
     public void rename( NextInterceptor nextInterceptor, RenameOperationContext opContext )
-        throws NamingException
+        throws Exception
     {
         if ( enabled )
         {
@@ -355,7 +352,7 @@
     }
 
 
-    public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws NamingException
+    public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws Exception
     {
         if ( enabled )
         {
@@ -366,7 +363,7 @@
     }
 
 
-    public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext opContext ) throws NamingException
+    public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext opContext ) throws Exception
     {
         if ( enabled )
         {
@@ -377,7 +374,7 @@
     }
 
 
-    private void protectDnAlterations( LdapDN dn ) throws NamingException
+    private void protectDnAlterations( LdapDN dn ) throws Exception
     {
         LdapDN principalDn = getPrincipal().getJndiName();
 
@@ -425,7 +422,7 @@
     }
 
 
-    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws NamingException
+    public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext ) throws Exception
     {
         ServerEntry serverEntry = nextInterceptor.lookup( opContext );
         
@@ -439,7 +436,7 @@
     }
 
 
-    private void protectLookUp( LdapDN normalizedDn ) throws NamingException
+    private void protectLookUp( LdapDN normalizedDn ) throws Exception
     {
         LdapContext ctx = ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         LdapDN principalDn = ( ( ServerContext ) ctx ).getPrincipal().getJndiName();
@@ -497,9 +494,9 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
-        NamingEnumeration<ServerSearchResult> e = nextInterceptor.search( opContext );
+        Cursor<ServerEntry> e = nextInterceptor.search( opContext );
 
         if ( !enabled )
         {
@@ -508,21 +505,23 @@
 
         Invocation invocation = InvocationStack.getInstance().peek();
 
-        return new SearchResultFilteringEnumeration( e, opContext.getSearchControls(), invocation, 
-            new SearchResultFilter()
-        {
-            public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
-                throws NamingException
-            {
-                return DefaultAuthorizationInterceptor.this.isSearchable( invocation, result );
-            }
-        }, "Search Default Authorization filter" );
+//        return new SearchResultFilteringEnumeration( e, opContext.getSearchControls(), invocation, 
+//            new SearchResultFilter()
+//        {
+//            public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+//                throws Exception
+//            {
+//                return DefaultAuthorizationInterceptor.this.isSearchable( invocation, result );
+//            }
+//        }, "Search Default Authorization filter" );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
-        NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
+        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
         
         if ( !enabled )
         {
@@ -531,18 +530,21 @@
 
         Invocation invocation = InvocationStack.getInstance().peek();
         
-        return new SearchResultFilteringEnumeration( result, null, invocation, new SearchResultFilter()
-        {
-            public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
-                throws NamingException
-            {
-                return DefaultAuthorizationInterceptor.this.isSearchable( invocation, result );
-            }
-        }, "List Default Authorization filter" );
+//        return new SearchResultFilteringEnumeration( result, null, invocation, new SearchResultFilter()
+//        {
+//            public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
+//                throws Exception
+//            {
+//                return DefaultAuthorizationInterceptor.this.isSearchable( invocation, result );
+//            }
+//        }, "List Default Authorization filter" );
+        
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
-    private boolean isSearchable( Invocation invocation, ServerSearchResult result ) throws NamingException
+    private boolean isSearchable( Invocation invocation, ServerSearchResult result ) throws Exception
     {
         LdapDN principalDn = ( ( ServerContext ) invocation.getCaller() ).getPrincipal().getJndiName();
         LdapDN dn = result.getDn();

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed May 21 13:36:48 2008
@@ -49,8 +49,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-
 
 /**
  * An interceptor which intercepts write operations to the directory and
@@ -90,7 +88,7 @@
     // Overridden (only change inducing) intercepted methods
     // -----------------------------------------------------------------------
 
-    public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
     {
         next.add( opContext );
 
@@ -121,7 +119,7 @@
      * The delete operation has to be stored with a way to restore the deleted element.
      * There is no way to do that but reading the entry and dump it into the LOG.
      */
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
     {
         // @todo make sure we're not putting in operational attributes that cannot be user modified
         // must save the entry if change log is enabled
@@ -152,9 +150,9 @@
      *
      * @param dn the dn of the entry to get
      * @return the entry's attributes (may be immutable if the schema subentry)
-     * @throws NamingException on error accessing the entry's attributes
+     * @throws Exception on error accessing the entry's attributes
      */
-    private ServerEntry getAttributes( OperationContext opContext ) throws NamingException
+    private ServerEntry getAttributes( OperationContext opContext ) throws Exception
     {
         LdapDN dn = opContext.getDn();
         ServerEntry serverEntry;
@@ -176,7 +174,7 @@
     }
 
 
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         ServerEntry serverEntry = null;
         Modification modification = ServerEntryUtils.getModificationItem( opContext.getModItems(), entryDeleted );
@@ -224,7 +222,7 @@
     // -----------------------------------------------------------------------
 
 
-    public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
+    public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws Exception
     {
         ServerEntry serverEntry = null;
         
@@ -254,7 +252,7 @@
 
 
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opCtx )
-        throws NamingException
+        throws Exception
     {
         ServerEntry serverEntry = null;
         
@@ -287,7 +285,7 @@
     }
 
 
-    public void move ( NextInterceptor next, MoveOperationContext opCtx ) throws NamingException
+    public void move ( NextInterceptor next, MoveOperationContext opCtx ) throws Exception
     {
         next.move( opCtx );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java Wed May 21 13:36:48 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.directory.server.core.changelog;
 
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
@@ -42,7 +43,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.PrintWriter;
@@ -215,7 +215,7 @@
     // Overridden (only change inducing) intercepted methods
     // -----------------------------------------------------------------------
 
-    public void add( NextInterceptor next, AddOperationContext opContext ) throws NamingException
+    public void add( NextInterceptor next, AddOperationContext opContext ) throws Exception
     {
         StringBuilder buf;
         next.add( opContext );
@@ -247,7 +247,7 @@
      * The delete operation has to be stored with a way to restore the deleted element.
      * There is no way to do that but reading the entry and dump it into the LOG.
      */
-    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
+    public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
     {
         next.delete( opContext );
 
@@ -278,7 +278,7 @@
     }
 
     
-    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+    public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
     {
         StringBuilder buf;
         next.modify( opContext );
@@ -323,7 +323,7 @@
     // -----------------------------------------------------------------------
 
     
-    public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws NamingException
+    public void rename ( NextInterceptor next, RenameOperationContext renameContext ) throws Exception
     {
         next.rename( renameContext );
         
@@ -360,7 +360,7 @@
 
     
     public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameOperationContext )
-        throws NamingException
+        throws Exception
     {
         next.moveAndRename( moveAndRenameOperationContext );
         
@@ -397,7 +397,7 @@
     }
 
     
-    public void move ( NextInterceptor next, MoveOperationContext moveOperationContext ) throws NamingException
+    public void move ( NextInterceptor next, MoveOperationContext moveOperationContext ) throws Exception
     {
         next.move( moveOperationContext );
         
@@ -444,9 +444,9 @@
      * @param buf the buffer written to and returned (for chaining)
      * @param attr the attribute written to the buffer
      * @return the buffer argument to allow for call chaining.
-     * @throws NamingException if the attribute is not identified by the registry
+     * @throws Exception if the attribute is not identified by the registry
      */
-    private StringBuilder append( StringBuilder buf, ServerAttribute attr ) throws NamingException
+    private StringBuilder append( StringBuilder buf, ServerAttribute attr ) throws Exception
     {
         String id = attr.getId();
         boolean isBinary = ! atRegistry.lookup( id ).getSyntax().isHumanReadable();
@@ -500,9 +500,9 @@
      * the user is anonymous "" is returned.
      * 
      * @return the DN of the user executing the current intercepted operation
-     * @throws NamingException if we cannot access the interceptor stack
+     * @throws Exception if we cannot access the interceptor stack
      */
-    private String getPrincipalName() throws NamingException
+    private String getPrincipalName() throws Exception
     {
         ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
         return ctx.getPrincipal().getName();
@@ -522,9 +522,9 @@
      * @param mod the modified values if any for that attribute
      * @param modOp the modification operation as a string followd by ": "
      * @return the buffer argument provided for chaining
-     * @throws NamingException if the modification attribute id is undefined
+     * @throws Exception if the modification attribute id is undefined
      */
-    private StringBuilder append( StringBuilder buf, ServerAttribute mod, String modOp ) throws NamingException
+    private StringBuilder append( StringBuilder buf, ServerAttribute mod, String modOp ) throws Exception
     {
         buf.append( "\n" );
         buf.append( modOp );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Wed May 21 13:36:48 2008
@@ -20,12 +20,13 @@
 package org.apache.directory.server.core.collective;
 
 
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 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;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -44,7 +45,6 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 
-import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.SearchControls;
 import java.util.HashSet;
@@ -329,22 +329,28 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
-        NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
+        Cursor<ServerEntry> result = nextInterceptor.list( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
         
-        return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, SEARCH_FILTER, "List collective Filter" );
+//        return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, SEARCH_FILTER, "List collective Filter" );
+        
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
-        NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
+        Cursor<ServerEntry> result = nextInterceptor.search( opContext );
         Invocation invocation = InvocationStack.getInstance().peek();
         
-        return new SearchResultFilteringEnumeration( 
-            result, opContext.getSearchControls(), invocation, SEARCH_FILTER, "Search collective Filter" );
+//        return new SearchResultFilteringEnumeration( 
+//            result, opContext.getSearchControls(), invocation, SEARCH_FILTER, "Search collective Filter" );
+        
+        // TODO not implemented
+        throw new NotImplementedException();
     }
     
     // ------------------------------------------------------------------------

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/ReferralHandlingEnumeration.java Wed May 21 13:36:48 2008
@@ -31,6 +31,7 @@
 
 import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.jndi.JndiUtils;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.core.referral.ReferralLut;
 import org.apache.directory.server.schema.registries.Registries;
@@ -189,7 +190,14 @@
         {
             LdapDN prefetchedDn = new LdapDN( prefetched.getDn() );
             prefetchedDn.normalize( normalizerMap );
-            refs = nexus.lookup( new LookupOperationContext( registries, prefetchedDn ) ).get( SchemaConstants.REF_AT );
+            try
+            {
+                refs = nexus.lookup( new LookupOperationContext( registries, prefetchedDn ) ).get( SchemaConstants.REF_AT );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
 
         if ( refs == null )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/enumeration/SearchResultFilteringEnumeration.java Wed May 21 13:36:48 2008
@@ -37,6 +37,7 @@
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.entry.ServerSearchResult;
 import org.apache.directory.server.core.invocation.Invocation;
+import org.apache.directory.server.core.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.exception.OperationAbandonedException;
 import org.apache.directory.shared.ldap.message.AbandonListener;
 import org.apache.directory.shared.ldap.message.AbandonableRequest;
@@ -313,7 +314,14 @@
             }
             else if ( filters.size() == 1 )
             {
-                accepted = filters.get( 0 ).accept( invocation, tmp, searchControls );
+                try
+                {
+                    accepted = filters.get( 0 ).accept( invocation, tmp, searchControls );
+                }
+                catch ( Exception e )
+                {
+                    JndiUtils.wrap( e );
+                }
                 if ( accepted )
                 {
                     this.prefetched = tmp;
@@ -328,7 +336,14 @@
             for ( int ii = 0; ii < filters.size(); ii++ )
             {
                 SearchResultFilter filter = filters.get( ii );
-                accepted &= filter.accept( invocation, tmp, searchControls );
+                try
+                {
+                    accepted &= filter.accept( invocation, tmp, searchControls );
+                }
+                catch ( Exception e )
+                {
+                    JndiUtils.wrap( e );
+                }
 
                 if ( !accepted )
                 {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed May 21 13:36:48 2008
@@ -22,9 +22,10 @@
 
 import org.apache.commons.collections.map.LRUMap;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.EmptyCursor;
 import org.apache.directory.server.core.entry.ServerAttribute;
 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.AddOperationContext;
@@ -58,10 +59,6 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
-import org.apache.directory.shared.ldap.util.EmptyEnumeration;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
 
 import java.util.List;
 import java.util.Map;
@@ -156,7 +153,7 @@
         // check if the entry already exists
         if ( nextInterceptor.hasEntry( new EntryOperationContext( registries, name ) ) )
         {
-            NamingException ne = new LdapNameAlreadyBoundException( name.getUpName() + " already exists!" );
+            LdapNameAlreadyBoundException ne = new LdapNameAlreadyBoundException( name.getUpName() + " already exists!" );
             ne.setResolvedName( new LdapDN( name.getUpName() ) );
             throw ne;
         }
@@ -196,7 +193,7 @@
             {
                 String msg = "Attempt to add entry to alias '" + name.getUpName() + "' not allowed.";
                 ResultCodeEnum rc = ResultCodeEnum.ALIAS_PROBLEM;
-                NamingException e = new LdapNamingException( msg, rc );
+                LdapNamingException e = new LdapNamingException( msg, rc );
                 e.setResolvedName( new LdapDN( parentDn.getUpName() ) );
                 throw e;
             }
@@ -235,9 +232,9 @@
 
         // check if entry to delete has children (only leaves can be deleted)
         boolean hasChildren = false;
-        NamingEnumeration<ServerSearchResult> list = nextInterceptor.list( new ListOperationContext( registries, name ) );
+        Cursor<ServerEntry> list = nextInterceptor.list( new ListOperationContext( registries, name ) );
         
-        if ( list.hasMore() )
+        if ( list.next() )
         {
             hasChildren = true;
         }
@@ -266,12 +263,12 @@
     /**
      * Checks to see the base being searched exists, otherwise throws the appropriate LdapException.
      */
-    public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
+    public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws Exception
     {
         if ( opContext.getDn().getNormName().equals( subschemSubentryDn.getNormName() ) )
         {
             // there is nothing under the schema subentry
-            return new EmptyEnumeration<ServerSearchResult>();
+            return new EmptyCursor<ServerEntry>();
         }
         
         // check if entry to search exists
@@ -519,15 +516,15 @@
     /**
      * Checks to see the entry being searched exists, otherwise throws the appropriate LdapException.
      */
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
+    public Cursor<ServerEntry> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws Exception
     {
         LdapDN base = opContext.getDn();
 
         try
         {
-	        NamingEnumeration<ServerSearchResult> result =  nextInterceptor.search( opContext );
+            Cursor<ServerEntry> result =  nextInterceptor.search( opContext );
 	        
-	        if ( ! result.hasMoreElements() )
+	        if ( ! result.next() )
 	        {
 	            if ( !base.isEmpty() && !( subschemSubentryDn.toNormName() ).equalsIgnoreCase( base.toNormName() ) )
 	            {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java Wed May 21 13:36:48 2008
@@ -71,8 +71,16 @@
             return new DeadContext();
         }
 
-        ServerLdapContext ctx = ( ServerLdapContext ) service.getJndiContext( principalDn, principal, credential,
-                authentication, providerUrl );
+        ServerLdapContext ctx = null;
+        try
+        {
+            ctx = ( ServerLdapContext ) service.getJndiContext( principalDn, principal, credential,
+                    authentication, providerUrl );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
 
         // check to make sure we have access to the specified dn in provider URL
         ctx.lookup( "" );

Added: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/JndiUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/JndiUtils.java?rev=658851&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/JndiUtils.java (added)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/JndiUtils.java Wed May 21 13:36:48 2008
@@ -0,0 +1,44 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.directory.server.core.jndi;
+
+import javax.naming.NamingException;
+
+/**
+ * TODO JndiUtils.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class JndiUtils
+{
+    public static void wrap( Throwable t ) throws NamingException
+    {
+        if ( t instanceof NamingException )
+        {
+            throw ( NamingException ) t;
+        }
+        
+        NamingException ne = new NamingException( t.getMessage() );
+        ne.setRootCause( t );
+        throw ne;
+    }
+}

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Wed May 21 13:36:48 2008
@@ -20,14 +20,15 @@
 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.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.cursor.Cursor;
 import org.apache.directory.server.core.entry.DefaultServerEntry;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 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;
@@ -146,7 +147,7 @@
      */
     @SuppressWarnings(value =
         { "unchecked" })
-    protected ServerContext( DirectoryService service, Hashtable<String, Object> env ) throws NamingException
+    protected ServerContext( DirectoryService service, Hashtable<String, Object> env ) throws Exception
     {
         this.service = service;
 
@@ -209,7 +210,7 @@
      * @param entry
      * @param target
      */
-    protected void doAddOperation( LdapDN target, ServerEntry entry ) throws NamingException
+    protected void doAddOperation( LdapDN target, ServerEntry entry ) throws Exception
     {
         // setup the op context and populate with request controls
         AddOperationContext opCtx = new AddOperationContext( service.getRegistries(), entry );
@@ -229,7 +230,7 @@
      * Used to encapsulate [de]marshalling of controls before and after delete operations.
      * @param target
      */
-    protected void doDeleteOperation( LdapDN target ) throws NamingException
+    protected void doDeleteOperation( LdapDN target ) throws Exception
     {
         // setup the op context and populate with request controls
         DeleteOperationContext opCtx = new DeleteOperationContext( registries, target );
@@ -252,8 +253,8 @@
      * @param searchControls
      * @return NamingEnumeration
      */
-    protected NamingEnumeration<ServerSearchResult> doSearchOperation( LdapDN dn, AliasDerefMode aliasDerefMode,
-        ExprNode filter, SearchControls searchControls ) throws NamingException
+    protected Cursor<ServerEntry> doSearchOperation( LdapDN dn, AliasDerefMode aliasDerefMode,
+        ExprNode filter, SearchControls searchControls ) throws Exception
     {
         // setup the op context and populate with request controls
         SearchOperationContext opCtx = new SearchOperationContext( registries, dn, aliasDerefMode, filter,
@@ -261,7 +262,7 @@
         opCtx.addRequestControls( requestControls );
 
         // execute search operation
-        NamingEnumeration<ServerSearchResult> results = nexusProxy.search( opCtx );
+        Cursor<ServerEntry> results = nexusProxy.search( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
@@ -274,14 +275,14 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after list operations.
      */
-    protected NamingEnumeration<ServerSearchResult> doListOperation( LdapDN target ) throws NamingException
+    protected Cursor<ServerEntry> doListOperation( LdapDN target ) throws Exception
     {
         // setup the op context and populate with request controls
         ListOperationContext opCtx = new ListOperationContext( registries, target );
         opCtx.addRequestControls( requestControls );
 
         // execute list operation
-        NamingEnumeration<ServerSearchResult> results = nexusProxy.list( opCtx );
+        Cursor<ServerEntry> results = nexusProxy.list( opCtx );
 
         // clear the request controls and set the response controls 
         requestControls = EMPTY_CONTROLS;
@@ -291,7 +292,7 @@
     }
 
 
-    protected ServerEntry doGetRootDSEOperation( LdapDN target ) throws NamingException
+    protected ServerEntry doGetRootDSEOperation( LdapDN target ) throws Exception
     {
         GetRootDSEOperationContext opCtx = new GetRootDSEOperationContext( registries, target );
         opCtx.addRequestControls( requestControls );
@@ -305,7 +306,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after lookup operations.
      */
-    protected ServerEntry doLookupOperation( LdapDN target ) throws NamingException
+    protected ServerEntry doLookupOperation( LdapDN target ) throws Exception
     {
         // setup the op context and populate with request controls
         LookupOperationContext opCtx;
@@ -325,7 +326,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after lookup operations.
      */
-    protected ServerEntry doLookupOperation( LdapDN target, String[] attrIds ) throws NamingException
+    protected ServerEntry doLookupOperation( LdapDN target, String[] attrIds ) throws Exception
     {
         // setup the op context and populate with request controls
         LookupOperationContext opCtx;
@@ -357,7 +358,7 @@
      * Used to encapsulate [de]marshalling of controls before and after bind operations.
      */
     protected void doBindOperation( LdapDN bindDn, byte[] credentials, List<String> mechanisms, String saslAuthId )
-        throws NamingException
+        throws Exception
     {
         // setup the op context and populate with request controls
         BindOperationContext opCtx = new BindOperationContext( registries );
@@ -380,7 +381,7 @@
      * Used to encapsulate [de]marshalling of controls before and after moveAndRename operations.
      */
     protected void doMoveAndRenameOperation( LdapDN oldDn, LdapDN parent, String newRdn, boolean delOldDn )
-        throws NamingException
+        throws Exception
     {
         // setup the op context and populate with request controls
         MoveAndRenameOperationContext opCtx = new MoveAndRenameOperationContext( registries, oldDn, parent, new Rdn(
@@ -399,7 +400,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after modify operations.
      */
-    protected void doModifyOperation( LdapDN dn, List<Modification> modifications ) throws NamingException
+    protected void doModifyOperation( LdapDN dn, List<Modification> modifications ) throws Exception
     {
         // setup the op context and populate with request controls
         ModifyOperationContext opCtx = new ModifyOperationContext( registries, dn, modifications );
@@ -417,7 +418,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after moveAndRename operations.
      */
-    protected void doMove( LdapDN oldDn, LdapDN target ) throws NamingException
+    protected void doMove( LdapDN oldDn, LdapDN target ) throws Exception
     {
         // setup the op context and populate with request controls
         MoveOperationContext opCtx = new MoveOperationContext( registries, oldDn, target );
@@ -435,7 +436,7 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after rename operations.
      */
-    protected void doRename( LdapDN oldDn, String newRdn, boolean delOldRdn ) throws NamingException
+    protected void doRename( LdapDN oldDn, String newRdn, boolean delOldRdn ) throws Exception
     {
         // setup the op context and populate with request controls
         RenameOperationContext opCtx = new RenameOperationContext( registries, oldDn, new Rdn( newRdn ), delOldRdn );
@@ -630,7 +631,14 @@
          * we need to copy over the controls as well to propagate the complete 
          * environment besides what's in the hashtable for env.
          */
-        doAddOperation( target, serverEntry );
+        try
+        {
+            doAddOperation( target, serverEntry );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
         return new ServerLdapContext( service, principal, target );
     }
 
@@ -656,7 +664,14 @@
             throw new LdapNoPermissionException( "can't delete the rootDSE" );
         }
 
-        doDeleteOperation( target );
+        try
+        {
+            doDeleteOperation( target );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
     }
 
 
@@ -704,13 +719,27 @@
 
         if ( outServerEntry != null )
         {
-            doAddOperation( target, outServerEntry );
+            try
+            {
+                doAddOperation( target, outServerEntry );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
             return;
         }
 
         if ( obj instanceof ServerEntry )
         {
-            doAddOperation( target, ( ServerEntry ) obj );
+            try
+            {
+                doAddOperation( target, ( ServerEntry ) obj );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         // Check for Referenceable
         else if ( obj instanceof Referenceable )
@@ -741,7 +770,14 @@
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( serverEntry, obj, registries );
-            doAddOperation( target, serverEntry );
+            try
+            {
+                doAddOperation( target, serverEntry );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         else if ( obj instanceof DirContext )
         {
@@ -758,7 +794,14 @@
             }
 
             injectRdnAttributeValues( target, serverEntry );
-            doAddOperation( target, serverEntry );
+            try
+            {
+                doAddOperation( target, serverEntry );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         else
         {
@@ -820,7 +863,14 @@
          */
         if ( ( oldName.size() == newName.size() ) && oldBase.equals( newBase ) )
         {
-            doRename( oldDn, newRdn, delOldRdn );
+            try
+            {
+                doRename( oldDn, newRdn, delOldRdn );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         else
         {
@@ -829,11 +879,25 @@
 
             if ( newRdn.equalsIgnoreCase( oldRdn ) )
             {
-                doMove( oldDn, target );
+                try
+                {
+                    doMove( oldDn, target );
+                }
+                catch ( Exception e )
+                {
+                    JndiUtils.wrap( e );
+                }
             }
             else
             {
-                doMoveAndRenameOperation( oldDn, target, newRdn, delOldRdn );
+                try
+                {
+                    doMoveAndRenameOperation( oldDn, target, newRdn, delOldRdn );
+                }
+                catch ( Exception e )
+                {
+                    JndiUtils.wrap( e );
+                }
             }
         }
     }
@@ -855,9 +919,16 @@
     {
         LdapDN target = buildTarget( name );
 
-        if ( nexusProxy.hasEntry( new EntryOperationContext( registries, target ) ) )
+        try
         {
-            doDeleteOperation( target );
+            if ( nexusProxy.hasEntry( new EntryOperationContext( registries, target ) ) )
+            {
+                doDeleteOperation( target );
+            }
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
         }
 
         bind( name, obj );
@@ -878,7 +949,14 @@
      */
     public void unbind( Name name ) throws NamingException
     {
-        doDeleteOperation( buildTarget( name ) );
+        try
+        {
+            doDeleteOperation( buildTarget( name ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
     }
 
 
@@ -906,15 +984,22 @@
         Object obj;
         LdapDN target = buildTarget( name );
 
-        ServerEntry serverEntry;
+        ServerEntry serverEntry = null;
 
-        if ( name.size() == 0 )
+        try
         {
-            serverEntry = doGetRootDSEOperation( target );
+            if ( name.size() == 0 )
+            {
+                serverEntry = doGetRootDSEOperation( target );
+            }
+            else
+            {
+                serverEntry = doLookupOperation( target );
+            }
         }
-        else
+        catch ( Exception e )
         {
-            serverEntry = doLookupOperation( target );
+            JndiUtils.wrap( e );
         }
 
         try
@@ -1024,7 +1109,9 @@
         { "unchecked" })
     public NamingEnumeration list( Name name ) throws NamingException
     {
-        return ServerEntryUtils.toSearchResultEnum( doListOperation( buildTarget( name ) ) );
+//        return ServerEntryUtils.toSearchResultEnum( doListOperation( buildTarget( name ) ) );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
@@ -1052,7 +1139,9 @@
         SearchControls ctls = new SearchControls();
         ctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return doSearchOperation( base, aliasDerefMode, filter, ctls );
+//        return doSearchOperation( base, aliasDerefMode, filter, ctls );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 

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=658851&r1=658850&r2=658851&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 Wed May 21 13:36:48 2008
@@ -20,6 +20,7 @@
 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;
@@ -90,7 +91,7 @@
      * @param env the environment used for this context
      * @throws NamingException if something goes wrong
      */
-    public ServerDirContext( DirectoryService service, Hashtable<String, Object> env ) throws NamingException
+    public ServerDirContext( DirectoryService service, Hashtable<String, Object> env ) throws Exception
     {
         super( service, env );
     }
@@ -127,7 +128,18 @@
      */
     public Attributes getAttributes( Name name ) throws NamingException
     {
-        return ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ) ) );
+        Attributes attrs = null;
+        
+        try
+        {
+            attrs = ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ) ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
+        
+        return attrs;
     }
 
 
@@ -147,7 +159,17 @@
      */
     public Attributes getAttributes( Name name, String[] attrIds ) throws NamingException
     {
-        return ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ), attrIds ) );
+        Attributes attrs = null;
+        try
+        {
+            attrs = ServerEntryUtils.toAttributesImpl( doLookupOperation( buildTarget( name ), attrIds ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
+        
+        return attrs;
     }
 
 
@@ -183,13 +205,20 @@
         List<Modification> newMods = ServerEntryUtils.toServerModification( modItems, registries
             .getAttributeTypeRegistry() );
 
-        if ( name instanceof LdapDN )
+        try
         {
-            doModifyOperation( buildTarget( name ), newMods );
+            if ( name instanceof LdapDN )
+            {
+                doModifyOperation( buildTarget( name ), newMods );
+            }
+            else
+            {
+                doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+            }
         }
-        else
+        catch( Exception e )
         {
-            doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+            JndiUtils.wrap( e );
         }
     }
 
@@ -229,7 +258,14 @@
     {
         List<Modification> newMods = ServerEntryUtils
             .toServerModification( mods, registries.getAttributeTypeRegistry() );
-        doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+        try
+        {
+            doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
     }
 
 
@@ -241,7 +277,14 @@
     {
         List<Modification> newMods = ServerEntryUtils
             .toServerModification( mods, registries.getAttributeTypeRegistry() );
-        doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+        try
+        {
+            doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
     }
 
 
@@ -283,7 +326,14 @@
         if ( null == obj )
         {
             ServerEntry clone = ( ServerEntry ) serverEntry.clone();
-            doAddOperation( target, clone );
+            try
+            {
+                doAddOperation( target, clone );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
             return;
         }
 
@@ -303,7 +353,14 @@
                 }
             }
 
-            doAddOperation( target, clone );
+            try
+            {
+                doAddOperation( target, clone );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
             return;
         }
 
@@ -334,7 +391,14 @@
 
             // Serialize object into entry attributes and add it.
             JavaLdapSupport.serialize( serverEntry, obj, registries );
-            doAddOperation( target, clone );
+            try
+            {
+                doAddOperation( target, clone );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         else if ( obj instanceof DirContext )
         {
@@ -350,7 +414,14 @@
                 }
             }
 
-            doAddOperation( target, entry );
+            try
+            {
+                doAddOperation( target, entry );
+            }
+            catch ( Exception e )
+            {
+                JndiUtils.wrap( e );
+            }
         }
         else
         {
@@ -377,9 +448,16 @@
     {
         LdapDN target = buildTarget( name );
 
-        if ( getNexusProxy().hasEntry( new EntryOperationContext( registries, target ) ) )
+        try
+        {
+            if ( getNexusProxy().hasEntry( new EntryOperationContext( registries, target ) ) )
+            {
+                doDeleteOperation( target );
+            }
+        }
+        catch ( Exception e )
         {
-            doDeleteOperation( target );
+            JndiUtils.wrap( e );
         }
 
         bind( name, obj, AttributeUtils.toCaseInsensitive( attrs ) );
@@ -451,7 +529,14 @@
         }
 
         // Add the new context to the server which as a side effect adds
-        doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+        try
+        {
+            doAddOperation( target, ServerEntryUtils.toServerEntry( attributes, target, registries ) );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
 
         // Initialize the new context
         return new ServerLdapContext( getService(), getPrincipal(), target );
@@ -552,7 +637,9 @@
         {
             PresenceNode filter = new PresenceNode( SchemaConstants.OBJECT_CLASS_AT );
             AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-            return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
+//            return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
+            // TODO not implemented
+            throw new NotImplementedException();
         }
 
         // Handle simple filter expressions without multiple terms
@@ -577,7 +664,9 @@
                 }
 
                 AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-                return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, node, ctls ) );
+//                return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, node, ctls ) );
+                // TODO not implemented
+                throw new NotImplementedException();
             }
         }
 
@@ -624,7 +713,9 @@
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
+//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, ctls ) );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
@@ -655,7 +746,9 @@
     {
         LdapDN target = buildTarget( name );
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, cons ) );
+//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filter, cons ) );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 
@@ -682,7 +775,9 @@
         }
 
         AliasDerefMode aliasDerefMode = AliasDerefMode.getEnum( getEnvironment() );
-        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filterNode, cons ) );
+//        return ServerEntryUtils.toSearchResultEnum( doSearchOperation( target, aliasDerefMode, filterNode, cons ) );
+        // TODO not implemented
+        throw new NotImplementedException();
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java?rev=658851&r1=658850&r2=658851&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerLdapContext.java Wed May 21 13:36:48 2008
@@ -61,7 +61,7 @@
      * @param env the JNDI environment parameters
      * @throws NamingException the context cannot be created
      */
-    public ServerLdapContext( DirectoryService service, Hashtable<String, Object> env ) throws NamingException
+    public ServerLdapContext( DirectoryService service, Hashtable<String, Object> env ) throws Exception
     {
         super( service, env );
         refService = ( ( ReferralInterceptor ) service.getInterceptorChain().get( ReferralInterceptor.class.getName() ) );
@@ -234,7 +234,14 @@
         LdapDN principalDn = super.getPrincipal().getJndiName();
         UnbindOperationContext opCtx = new UnbindOperationContext( registries, principalDn );
         opCtx.addRequestControls( requestControls );
-        super.getNexusProxy().unbind( opCtx );
+        try
+        {
+            super.getNexusProxy().unbind( opCtx );
+        }
+        catch ( Exception e )
+        {
+            JndiUtils.wrap( e );
+        }
         responseControls = opCtx.getResponseControls();
         requestControls = EMPTY_CONTROLS;
     }



Mime
View raw message