directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r591817 [2/4] - in /directory/studio/trunk: studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/ studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ studio-ldapbrow...
Date Sun, 04 Nov 2007 19:10:26 GMT
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java Sun Nov  4 11:10:19 2007
@@ -31,6 +31,7 @@
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
@@ -38,7 +39,6 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.io.FileUtils;
@@ -47,6 +47,7 @@
 import org.apache.directory.studio.connection.core.ConnectionFolder;
 import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
+import org.apache.directory.studio.connection.core.io.ConnectionIOException;
 import org.apache.directory.studio.ldapbrowser.core.events.BookmarkUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.BookmarkUpdateListener;
 import org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateEvent;
@@ -388,33 +389,63 @@
      */
     private void saveBrowserConnections()
     {
-        Object[][] object = new Object[connectionMap.size()][3];
-
-        Iterator<IBrowserConnection> connectionIterator = connectionMap.values().iterator();
-        for ( int i = 0; connectionIterator.hasNext(); i++ )
+        // To avoid a corrupt file, save object to a temp file first 
+        try
         {
-            IBrowserConnection browserConnection = connectionIterator.next();
-            
-            ISearch[] searches = browserConnection.getSearchManager().getSearches();
-            SearchParameter[] searchParameters = new SearchParameter[searches.length];
-            for ( int k = 0; k < searches.length; k++ )
-            {
-                searchParameters[k] = searches[k].getSearchParameter();
-            }
-            
-            IBookmark[] bookmarks = browserConnection.getBookmarkManager().getBookmarks();
-            BookmarkParameter[] bookmarkParameters = new BookmarkParameter[bookmarks.length];
-            for ( int k = 0; k < bookmarks.length; k++ )
-            {
-                bookmarkParameters[k] = bookmarks[k].getBookmarkParameter();
-            }
+            BrowserConnectionIO.save( new FileOutputStream( getBrowserConnectionStoreFileName() + "-temp" ), connectionMap );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
 
-            object[i][0] = browserConnection.getConnection().getId();
-            object[i][1] = searchParameters;
-            object[i][2] = bookmarkParameters;
+        // move temp file to good file
+        File file = new File( getBrowserConnectionStoreFileName() );
+        File tempFile = new File( getBrowserConnectionStoreFileName() + "-temp" );
+        if ( file.exists() )
+        {
+            file.delete();
         }
 
-        save( object, getBrowserConnectionStoreFileName() );
+        try
+        {
+            String content = FileUtils.readFileToString( tempFile, "UTF-8" );
+            FileUtils.writeStringToFile( file, content, "UTF-8" );
+        }
+        catch ( IOException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        
+//        Object[][] object = new Object[connectionMap.size()][3];
+//
+//        Iterator<IBrowserConnection> connectionIterator = connectionMap.values().iterator();
+//        for ( int i = 0; connectionIterator.hasNext(); i++ )
+//        {
+//            IBrowserConnection browserConnection = connectionIterator.next();
+//            
+//            ISearch[] searches = browserConnection.getSearchManager().getSearches();
+//            SearchParameter[] searchParameters = new SearchParameter[searches.length];
+//            for ( int k = 0; k < searches.length; k++ )
+//            {
+//                searchParameters[k] = searches[k].getSearchParameter();
+//            }
+//            
+//            IBookmark[] bookmarks = browserConnection.getBookmarkManager().getBookmarks();
+//            BookmarkParameter[] bookmarkParameters = new BookmarkParameter[bookmarks.length];
+//            for ( int k = 0; k < bookmarks.length; k++ )
+//            {
+//                bookmarkParameters[k] = bookmarks[k].getBookmarkParameter();
+//            }
+//
+//            object[i][0] = browserConnection.getConnection().getId();
+//            object[i][1] = searchParameters;
+//            object[i][2] = bookmarkParameters;
+//        }
+//
+//        save( object, getBrowserConnectionStoreFileName() );
     }
 
 
@@ -465,64 +496,88 @@
             }
         }
         
+        // java.beans.XMLDecoder
         try
         {
-            Object[][] object = ( Object[][] ) this.load( getBrowserConnectionStoreFileName() );
-
-            if ( object != null )
+            String fileName = getBrowserConnectionStoreFileName();
+            File file = new File( fileName );
+            if ( file.exists() )
             {
-                try
+                String oldContent = FileUtils.readFileToString( file, "UTF-8" );
+                if(!oldContent.contains( "java.beans.XMLDecoder" ))
                 {
-                    for ( int i = 0; i < object.length; i++ )
+                    // new file format
+                    try
+                    {
+                        BrowserConnectionIO.load( new FileInputStream( getBrowserConnectionStoreFileName() ), connectionMap );
+                    }
+                    catch ( Exception e )
                     {
-                        String connectionId = ( String ) object[i][0];
-                        IBrowserConnection browserConnection = getBrowserConnectionById( connectionId );
-                        
-                        if( browserConnection != null )
+                        // If loading failed, try with temp file
+                        try
                         {
-                            if ( object[i].length > 0 )
-                            {
-                                SearchParameter[] searchParameters = ( SearchParameter[] ) object[i][1];
-                                for ( int k = 0; k < searchParameters.length; k++ )
-                                {
-                                    ISearch search = new Search( browserConnection, searchParameters[k] );
-                                    browserConnection.getSearchManager().addSearch( search );
-                                }
-                            }
-    
-                            if ( object[i].length > 1 )
+                            BrowserConnectionIO
+                                .load( new FileInputStream( getBrowserConnectionStoreFileName() + "-temp" ), connectionMap );
+                        }
+                        catch ( FileNotFoundException e1 )
+                        {
+                            // TODO Auto-generated catch block
+                            return;
+                        }
+                        catch ( ConnectionIOException e1 )
+                        {
+                            // TODO Auto-generated catch block
+                            return;
+                        }
+                    }
+                }
+                else 
+                {
+                    // old file format
+                    Object[][] object = ( Object[][] ) this.load( getBrowserConnectionStoreFileName() );
+
+                    if ( object != null )
+                    {
+                        try
+                        {
+                            for ( int i = 0; i < object.length; i++ )
                             {
-                                BookmarkParameter[] bookmarkParameters = ( BookmarkParameter[] ) object[i][2];
-                                for ( int k = 0; k < bookmarkParameters.length; k++ )
+                                String connectionId = ( String ) object[i][0];
+                                IBrowserConnection browserConnection = getBrowserConnectionById( connectionId );
+
+                                if ( browserConnection != null )
                                 {
-                                    IBookmark bookmark = new Bookmark( browserConnection, bookmarkParameters[k] );
-                                    browserConnection.getBookmarkManager().addBookmark( bookmark );
+                                    if ( object[i].length > 0 )
+                                    {
+                                        SearchParameter[] searchParameters = ( SearchParameter[] ) object[i][1];
+                                        for ( int k = 0; k < searchParameters.length; k++ )
+                                        {
+                                            ISearch search = new Search( browserConnection, searchParameters[k] );
+                                            browserConnection.getSearchManager().addSearch( search );
+                                        }
+                                    }
+
+                                    if ( object[i].length > 1 )
+                                    {
+                                        BookmarkParameter[] bookmarkParameters = ( BookmarkParameter[] ) object[i][2];
+                                        for ( int k = 0; k < bookmarkParameters.length; k++ )
+                                        {
+                                            IBookmark bookmark = new Bookmark( browserConnection, bookmarkParameters[k] );
+                                            browserConnection.getBookmarkManager().addBookmark( bookmark );
+                                        }
+                                    }
                                 }
                             }
-    
-//                            try
-//                            {
-//                                String schemaFilename = getSchemaCacheFileName( browserConnection.getName() );
-//                                FileReader reader = new FileReader( schemaFilename );
-//                                Schema schema = new Schema();
-//                                schema.loadFromLdif( reader );
-//                                browserConnection.setSchema( schema );
-//                            }
-//                            catch ( Exception e )
-//                            {
-//                            }
-    
+                        }
+                        catch ( ArrayIndexOutOfBoundsException e )
+                        {
+                            // Thrown by decoder.readObject(), signals EOF
+                        }
+                        catch ( Exception e )
+                        {
+                            e.printStackTrace();
                         }
                     }
-
-                }
-                catch ( ArrayIndexOutOfBoundsException e )
-                {
-                    // Thrown by decoder.readObject(), signals EOF
-                }
-                catch ( Exception e )
-                {
-                    e.printStackTrace();
                 }
             }
         }
@@ -579,60 +634,6 @@
     }
 
 
-    /**
-     * Saves an Object into a serialized XML file
-     *
-     * @param object
-     *      the object to save
-     * @param filename
-     *      the filename to save to
-     */
-    private synchronized void save( Object object, String filename )
-    {
-        XMLEncoder encoder = null;
-        try
-        {
-            // to avoid a corrupt file, save object to a temp file first 
-            String tempFilename = filename + "-temp";
-            Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
-            encoder = new XMLEncoder( new BufferedOutputStream( new FileOutputStream( tempFilename ) ) );
-            encoder.setPersistenceDelegate( SearchScope.class, new TypeSafeEnumPersistenceDelegate() );
-            encoder.setPersistenceDelegate( ReferralHandlingMethod.class, new TypeSafeEnumPersistenceDelegate() );
-            encoder.setPersistenceDelegate( AliasDereferencingMethod.class, new TypeSafeEnumPersistenceDelegate() );
-            encoder.setExceptionListener( new ExceptionListener()
-            {
-                public void exceptionThrown( Exception e )
-                {
-                    e.printStackTrace();
-                }
-            } );
-            encoder.writeObject( object );
-            encoder.close();
-
-            // move temp file to good file
-            File file = new File( filename );
-            File tempFile = new File( tempFilename );
-            if ( file.exists() )
-            {
-                file.delete();
-            }
-            String content = FileUtils.readFileToString( tempFile, "UTF-8" );
-            FileUtils.writeStringToFile( file, content, "UTF-8" );
-        }
-        catch ( Exception e )
-        {
-            e.printStackTrace();
-        }
-        finally
-        {
-            if ( encoder != null )
-            {
-                encoder.close();
-            }
-        }
-    }
-    
-    
     class TypeSafeEnumPersistenceDelegate extends PersistenceDelegate
     {
         protected boolean mutatesTo( Object oldInstance, Object newInstance )

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeAddedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeAddedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeAddedEvent.java Sun Nov  4 11:10:19 2007
@@ -71,7 +71,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__added_att_to_dn, new String[]
-            { getAddedAttribute().getDescription(), getModifiedEntry().getDn().toString() } );
+            { getAddedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeDeletedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeDeletedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributeDeletedEvent.java Sun Nov  4 11:10:19 2007
@@ -71,7 +71,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__deleted_att_from_dn, new String[]
-            { getDeletedAttribute().getDescription(), getModifiedEntry().getDn().toString() } );
+            { getDeletedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
     }
     
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributesInitializedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributesInitializedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributesInitializedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/AttributesInitializedEvent.java Sun Nov  4 11:10:19 2007
@@ -54,7 +54,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__dn_attributes_initialized, new String[]
-            { getModifiedEntry().getDn().toString() } );
+            { getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ChildrenInitializedEvent.java Sun Nov  4 11:10:19 2007
@@ -53,7 +53,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__dn_children_initialized, new String[]
-            { getModifiedEntry().getDn().toString() } );
+            { getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueAddedEvent.java Sun Nov  4 11:10:19 2007
@@ -89,7 +89,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__empty_value_added_to_att_at_dn, new String[]
-            { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().toString() } );
+            { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EmptyValueDeletedEvent.java Sun Nov  4 11:10:19 2007
@@ -89,7 +89,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__empty_value_deleted_from_att_at_dn, new String[]
-            { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().toString() } );
+            { getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryAddedEvent.java Sun Nov  4 11:10:19 2007
@@ -53,7 +53,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__added_dn, new String[]
-            { getModifiedEntry().getDn().toString() } );
+            { getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryDeletedEvent.java Sun Nov  4 11:10:19 2007
@@ -53,7 +53,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__deleted_dn, new String[]
-            { getModifiedEntry().getDn().toString() } );
+            { getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryMovedEvent.java Sun Nov  4 11:10:19 2007
@@ -84,8 +84,8 @@
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__moved_oldrdn_from_oldparent_to_newparent,
             new String[]
-                { getOldEntry().getDn().getRdn().toString(), getOldEntry().getParententry().getDn().toString(),
-                    getNewEntry().getParententry().getDn().toString() } );
+                { getOldEntry().getDn().getRdn().getUpName(), getOldEntry().getParententry().getDn().getUpName(),
+                    getNewEntry().getParententry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EntryRenamedEvent.java Sun Nov  4 11:10:19 2007
@@ -83,7 +83,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__renamed_olddn_to_newdn, new String[]
-            { getOldEntry().getDn().toString(), getNewEntry().getDn().toString() } );
+            { getOldEntry().getDn().getUpName(), getNewEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueAddedEvent.java Sun Nov  4 11:10:19 2007
@@ -90,7 +90,7 @@
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__added_val_to_att_at_dn, new String[]
             { getAddedValue().getStringValue(), getModifiedAttribute().getDescription(),
-                getModifiedEntry().getDn().toString() } );
+                getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueDeletedEvent.java Sun Nov  4 11:10:19 2007
@@ -90,7 +90,7 @@
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__deleted_val_from_att_at_dn, new String[]
             { getDeletedValue().getStringValue(), getModifiedAttribute().getDescription(),
-                getModifiedEntry().getDn().toString() } );
+                getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueModifiedEvent.java Sun Nov  4 11:10:19 2007
@@ -107,7 +107,7 @@
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__replaced_oldval_by_newval_at_att_at_dn,
             new String[]
                 { getOldValue().getStringValue(), getNewValue().getStringValue(),
-                    getModifiedAttribute().getDescription(), getModifiedEntry().getDn().toString() } );
+                    getModifiedAttribute().getDescription(), getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/ValueRenamedEvent.java Sun Nov  4 11:10:19 2007
@@ -88,7 +88,7 @@
     public String toString()
     {
         return BrowserCoreMessages.bind( BrowserCoreMessages.event__renamed_oldval_by_newval_at_dn, new String[]
-            { getOldValue().toString(), getNewValue().toString(), getModifiedEntry().getDn().toString() } );
+            { getOldValue().toString(), getNewValue().toString(), getModifiedEntry().getDn().getUpName() } );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java Sun Nov  4 11:10:19 2007
@@ -149,18 +149,6 @@
 
     public final void execute()
     {
-        // prevent from running the job if there are no connections 
-        Connection[] connections = getConnections();
-        for ( Connection connection : connections )
-        {
-            if(connection == null)
-            {
-                // TODO: logger
-                System.out.println( "Null connection: " + this.getClass().getName() );
-                return;
-            }
-        }
-        
         setUser( true );
         schedule();
     }
@@ -283,7 +271,7 @@
     protected static String getLockIdentifier( IEntry entry )
     {
         return getLockIdentifier( entry.getBrowserConnection() ) + "_"
-            + new StringBuffer( entry.getDn().toString() ).reverse().toString();
+            + new StringBuffer( entry.getDn().getNormName() ).reverse().toString();
     }
 
 
@@ -302,7 +290,7 @@
     protected static String getLockIdentifier( ISearch search )
     {
         return getLockIdentifier( search.getBrowserConnection() ) + "_"
-            + new StringBuffer( search.getSearchBase().toString() ).reverse().toString();
+            + new StringBuffer( search.getSearchBase().getNormName() ).reverse().toString();
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CopyEntriesJob.java Sun Nov  4 11:10:19 2007
@@ -23,8 +23,13 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
 
+import javax.naming.InvalidNameException;
+
+import org.apache.directory.shared.ldap.name.AttributeTypeAndValue;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -35,9 +40,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.NameException;
-import org.apache.directory.studio.ldapbrowser.core.model.RDN;
-import org.apache.directory.studio.ldapbrowser.core.model.RDNPart;
 import org.apache.directory.studio.ldapbrowser.core.model.SearchParameter;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
@@ -47,6 +49,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Search;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
 
 
 /**
@@ -114,9 +117,9 @@
     {
         monitor.beginTask( entriesToCopy.length == 1 ? BrowserCoreMessages.bind(
             BrowserCoreMessages.jobs__copy_entries_task_1, new String[]
-                { entriesToCopy[0].getDn().toString(), parent.getDn().toString() } ) : BrowserCoreMessages.bind(
+                { entriesToCopy[0].getDn().getUpName(), parent.getDn().getUpName() } ) : BrowserCoreMessages.bind(
             BrowserCoreMessages.jobs__copy_entries_task_n, new String[]
-                { Integer.toString( entriesToCopy.length ), parent.getDn().toString() } ), 2 + entriesToCopy.length );
+                { Integer.toString( entriesToCopy.length ), parent.getDn().getUpName() } ), 2 + entriesToCopy.length );
 
         monitor.reportProgress( " " ); //$NON-NLS-1$
         monitor.worked( 1 );
@@ -129,7 +132,7 @@
                 IEntry entryToCopy = entriesToCopy[i];
 
                 if ( scope == SearchScope.OBJECT
-                    || !parent.getDn().toString().endsWith( entryToCopy.getDn().toString() ) )
+                    || !parent.getDn().getNormName().endsWith( entryToCopy.getDn().getNormName() ) )
                 {
                     num = copyEntryRecursive( entryToCopy, parent, scope, num, monitor );
                 }
@@ -198,7 +201,7 @@
                 IAttribute[] attributesToCopy = entryToCopy.getAttributes();
 
                 // create new entry
-                RDN rdn = entryToCopy.getRdn();
+                Rdn rdn = entryToCopy.getRdn();
                 IEntry newEntry = new Entry( parent, rdn );
 
                 // change RDN if entry already exists
@@ -206,9 +209,9 @@
                 IEntry testEntry = ReadEntryJob.getEntry( parent.getBrowserConnection(), newEntry.getDn(), testMonitor );
                 if ( testEntry != null )
                 {
-                    String rdnValue = rdn.getValue();
+                    Object rdnValue = rdn.getUpValue();
                     String newRdnValue = BrowserCoreMessages.bind( BrowserCoreMessages.copy_n_of_s, "", rdnValue ); //$NON-NLS-1$
-                    RDN newRdn = getNewRdn( rdn, newRdnValue );
+                    Rdn newRdn = getNewRdn( rdn, newRdnValue );
                     newEntry = new Entry( parent, newRdn );
                     testEntry = ReadEntryJob.getEntry( parent.getBrowserConnection(), newEntry.getDn(), testMonitor );
                     for ( int i = 2; testEntry != null; i++ )
@@ -241,18 +244,18 @@
                 }
 
                 // check if RDN attributes ar present
-                RDN newRdn = newEntry.getRdn();
-                RDNPart[] oldRdnParts = rdn.getParts();
-                for ( int i = 0; i < oldRdnParts.length; i++ )
+                Rdn newRdn = newEntry.getRdn();
+                Iterator<AttributeTypeAndValue> atavIterator = newRdn.iterator();
+                while(atavIterator.hasNext())
                 {
-                    RDNPart part = oldRdnParts[i];
-                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
+                    AttributeTypeAndValue atav = atavIterator.next();
+                    IAttribute rdnAttribute = newEntry.getAttribute( atav.getUpType() );
                     if ( rdnAttribute != null )
                     {
                         IValue[] values = rdnAttribute.getValues();
                         for ( int ii = 0; ii < values.length; ii++ )
                         {
-                            if ( part.getUnencodedValue().equals( values[ii].getRawValue() ) )
+                            if ( atav.getUpValue().equals( values[ii].getRawValue() ) )
                             {
                                 rdnAttribute.deleteValue( values[ii] );
                             }
@@ -263,16 +266,16 @@
                         }
                     }
                 }
-                RDNPart[] newRdnParts = newRdn.getParts();
-                for ( int i = 0; i < newRdnParts.length; i++ )
+                atavIterator = newRdn.iterator();
+                while(atavIterator.hasNext())
                 {
-                    RDNPart part = newRdnParts[i];
-                    IAttribute rdnAttribute = newEntry.getAttribute( part.getType() );
+                    AttributeTypeAndValue atav = atavIterator.next();
+                    IAttribute rdnAttribute = newEntry.getAttribute( atav.getUpType() );
                     if ( rdnAttribute == null )
                     {
-                        rdnAttribute = new Attribute( newEntry, part.getType() );
+                        rdnAttribute = new Attribute( newEntry, atav.getUpType() );
                         newEntry.addAttribute( rdnAttribute );
-                        rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
+                        rdnAttribute.addValue( new Value( rdnAttribute, atav.getUpValue() ) );
                     }
                     else
                     {
@@ -280,7 +283,7 @@
                         IValue[] values = rdnAttribute.getValues();
                         for ( int ii = 0; ii < values.length; ii++ )
                         {
-                            if ( part.getUnencodedValue().equals( values[ii].getStringValue() ) )
+                            if ( atav.getUpValue().equals( values[ii].getStringValue() ) )
                             {
                                 mustAdd = false;
                                 break;
@@ -288,7 +291,7 @@
                         }
                         if ( mustAdd )
                         {
-                            rdnAttribute.addValue( new Value( rdnAttribute, part.getUnencodedValue() ) );
+                            rdnAttribute.addValue( new Value( rdnAttribute, atav.getUpValue() ) );
                         }
                     }
                 }
@@ -352,15 +355,23 @@
      * @param newRdnValue the new rdn value
      * 
      * @return the new rdn
-     * 
-     * @throws NameException the name exception
+     * @throws InvalidNameException 
      */
-    private RDN getNewRdn( RDN rdn, String newRdnValue ) throws NameException
+    private Rdn getNewRdn( Rdn rdn, String newRdnValue ) throws InvalidNameException
     {
-        String[] names = rdn.getTypes();
-        String[] values = rdn.getValues();
-        values[0] = newRdnValue;
-        RDN newRdn = new RDN( names, values, true );
+        String[] rdnTypes = new String[rdn.size()];
+        String[] rdnValues = new String[rdn.size()];
+        int i = 0;
+        Iterator<AttributeTypeAndValue> atavIterator = rdn.iterator();
+        while(atavIterator.hasNext())
+        {
+            AttributeTypeAndValue atav = atavIterator.next();
+            rdnTypes[i] = atav.getUpType();
+            rdnValues[i] = ( String ) atav.getUpValue();
+            i++;
+        }
+        rdnValues[0] = newRdnValue;
+        Rdn newRdn = DnUtils.composeRdn( rdnTypes, rdnValues );
         return newRdn;
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateEntryJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateEntryJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateEntryJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateEntryJob.java Sun Nov  4 11:10:19 2007
@@ -98,7 +98,7 @@
     protected void executeNotificationJob( StudioProgressMonitor monitor )
     {
         monitor.beginTask( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__create_entry_task_1, new String[]
-            { entryToCreate.getDn().toString() } ), 2 + 1 );
+            { entryToCreate.getDn().getUpName() } ), 2 + 1 );
         monitor.reportProgress( " " ); //$NON-NLS-1$
         monitor.worked( 1 );
 
@@ -147,7 +147,7 @@
     static void createEntry( IBrowserConnection browserConnection, IEntry entryToCreate, StudioProgressMonitor monitor )
     {
         // dn
-        String dn = entryToCreate.getDn().toString();
+        String dn = entryToCreate.getDn().getUpName();
 
         // attributes
         Attributes jndiAttributes = new BasicAttributes();

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateValuesJob.java Sun Nov  4 11:10:19 2007
@@ -190,7 +190,7 @@
         if ( browserConnection.getConnection() != null )
         {
             // dn
-            String dn = entryToModify.getDn().toString();
+            String dn = entryToModify.getDn().getUpName();
 
             // modification items
             ModificationItem[] modificationItems = new ModificationItem[valuesToCreate.length];

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteAttributesValueJob.java Sun Nov  4 11:10:19 2007
@@ -222,7 +222,7 @@
         if ( browserConnection.getConnection() != null )
         {
             // dn
-            String dn = entry.getDn().toString();
+            String dn = entry.getDn().getUpName();
 
             // modification items
             List<ModificationItem> modificationItems = new ArrayList<ModificationItem>();

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/DeleteEntriesJob.java Sun Nov  4 11:10:19 2007
@@ -104,7 +104,7 @@
 
         monitor.beginTask( entriesToDelete.length == 1 ? BrowserCoreMessages.bind(
             BrowserCoreMessages.jobs__delete_entries_task_1, new String[]
-                { entriesToDelete[0].getDn().toString() } ) : BrowserCoreMessages.bind(
+                { entriesToDelete[0].getDn().getUpName() } ) : BrowserCoreMessages.bind(
             BrowserCoreMessages.jobs__delete_entries_task_n, new String[]
                 { Integer.toString( entriesToDelete.length ) } ), 2 + entriesToDelete.length );
         monitor.reportProgress( " " ); //$NON-NLS-1$
@@ -291,7 +291,7 @@
     static void deleteEntry( IBrowserConnection browserConnection, IEntry entry, StudioProgressMonitor monitor )
     {
         // dn
-        String dn = entry.getDn().toString();
+        String dn = entry.getDn().getUpName();
 
         // controls
         Control[] controls = null;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportDsmlJob.java Sun Nov  4 11:10:19 2007
@@ -50,7 +50,6 @@
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.ScopeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.dsmlv2.engine.Dsmlv2Engine;
@@ -140,7 +139,7 @@
             searchRequest.setProtocolOP( searchRequest );
 
             // DN
-            searchRequest.setBaseObject( new LdapDN( searchParameter.getSearchBase().toString() ) );
+            searchRequest.setBaseObject( searchParameter.getSearchBase( ) );
 
             // Scope
             SearchScope scope = searchParameter.getScope();

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportLdifJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportLdifJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportLdifJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportLdifJob.java Sun Nov  4 11:10:19 2007
@@ -34,14 +34,13 @@
 import javax.naming.directory.SearchResult;
 
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.model.ConnectionException;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
-import org.apache.directory.studio.ldapbrowser.core.model.NameException;
 import org.apache.directory.studio.ldapbrowser.core.model.ReferralException;
 import org.apache.directory.studio.ldapbrowser.core.model.SearchParameter;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
@@ -266,7 +265,7 @@
             try
             {
                 SearchResult sr = enumeration.next();
-                DN dn = JNDIUtils.getDn( sr );
+                LdapDN dn = JNDIUtils.getDn( sr );
                 LdifContentRecord record = LdifContentRecord.create( dn.toString() );
 
                 NamingEnumeration<? extends Attribute> attributeEnumeration = sr.getAttributes().getAll();
@@ -297,14 +296,6 @@
             catch ( NamingException e )
             {
                 throw JNDIUtils.createConnectionException( parameter, e );
-            }
-            catch ( NameException e )
-            {
-                throw new ConnectionException( e );
-            }
-            catch ( NoSuchFieldException e )
-            {
-                throw new ConnectionException( e );
             }
         }
     }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ImportLdifJob.java Sun Nov  4 11:10:19 2007
@@ -35,6 +35,7 @@
 import java.util.Date;
 import java.util.List;
 
+import javax.naming.InvalidNameException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
@@ -45,6 +46,7 @@
 import javax.naming.ldap.Control;
 
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
@@ -52,10 +54,8 @@
 import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.ConnectionException;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
-import org.apache.directory.studio.ldapbrowser.core.model.NameException;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifEnumeration;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeAddRecord;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.container.LdifChangeDeleteRecord;
@@ -71,6 +71,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifControlLine;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifModSpecTypeLine;
 import org.apache.directory.studio.ldapbrowser.core.model.ldif.parser.LdifParser;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
 
 
 /**
@@ -248,9 +249,9 @@
                         importedCount++;
 
                         // update cache and adjust attribute/children initialization flags
-                        DN dn = new DN( record.getDnLine().getValueAsString() );
+                        LdapDN dn = new LdapDN( record.getDnLine().getValueAsString() );
                         IEntry entry = browserConnection.getEntryFromCache( dn );
-                        DN parentDn = dn.getParentDn();
+                        LdapDN parentDn = DnUtils.getParent( dn );
                         IEntry parentEntry = parentDn != null ? browserConnection.getEntryFromCache( parentDn ) : null;
 
                         if ( record instanceof LdifChangeDeleteRecord )
@@ -279,7 +280,7 @@
                             LdifChangeModDnRecord modDnRecord = ( LdifChangeModDnRecord ) record;
                             if ( modDnRecord.getNewsuperiorLine() != null )
                             {
-                                DN newSuperiorDn = new DN( modDnRecord.getNewsuperiorLine().getValueAsString() );
+                                LdapDN newSuperiorDn = new LdapDN( modDnRecord.getNewsuperiorLine().getValueAsString() );
                                 IEntry newSuperiorEntry = browserConnection.getEntryFromCache( newSuperiorDn );
                                 if ( newSuperiorEntry != null )
                                 {
@@ -452,19 +453,20 @@
 
                 try
                 {
-                    DN newDn;
+                    LdapDN newDn;
                     if ( modDnRecord.getNewsuperiorLine() != null )
-                        newDn = new DN( newRdn, modDnRecord.getNewsuperiorLine().getValueAsString() );
+                        newDn = DnUtils.composeDn( newRdn, modDnRecord.getNewsuperiorLine().getValueAsString() );
                     else
                     {
-                        DN dnObject = new DN( dn );
-                        newDn = new DN( newRdn.toString(), dnObject.getParentDn().toString() );
+                        LdapDN dnObject = new LdapDN( dn );
+                        LdapDN parent = DnUtils.getParent( dnObject );
+                        newDn = DnUtils.composeDn( newRdn, parent.getUpName() );
                     }
 
                     browserConnection.getConnection().getJNDIConnectionWrapper().rename( dn, newDn.toString(),
                         deleteOldRdn, getControls( modDnRecord ), monitor );
                 }
-                catch ( NameException ne )
+                catch ( InvalidNameException ne )
                 {
                     throw new ConnectionException( ne );
                 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java Sun Nov  4 11:10:19 2007
@@ -28,19 +28,20 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.naming.InvalidNameException;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.AttributesInitializedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
-import org.apache.directory.studio.ldapbrowser.core.model.NameException;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch.SearchScope;
@@ -136,7 +137,7 @@
         for ( int pi = 0; pi < entries.length && !monitor.isCanceled(); pi++ )
         {
             monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_task, new String[]
-                { this.entries[pi].getDn().toString() } ) );
+                { this.entries[pi].getDn().getUpName() } ) );
             monitor.worked( 1 );
             if ( entries[pi].getBrowserConnection() != null && entries[pi].isDirectoryEntry() )
             {
@@ -209,7 +210,7 @@
     {
         monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_att,
             new String[]
-                { entry.getDn().toString() } ) );
+                { entry.getDn().getUpName() } ) );
 
         // entry.setAttributesInitialized(false, entry.getConnection());
 
@@ -293,7 +294,7 @@
         browserConnection.getRootDSE().setChildrenInitialized( false );
 
         // get well-known root DSE attributes, includes + and *
-        ISearch search = new Search( null, browserConnection, new DN(), ISearch.FILTER_TRUE,
+        ISearch search = new Search( null, browserConnection, LdapDN.EMPTY_LDAPDN, ISearch.FILTER_TRUE,
             InitializeAttributesJob.ROOT_DSE_ATTRIBUTES, SearchScope.OBJECT, 0, 0,
             AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, false, false,
             null );
@@ -302,17 +303,24 @@
         // get base DNs
         if( !browserConnection.isFetchBaseDNs() && browserConnection.getBaseDN() != null && !"".equals( browserConnection.getBaseDN().toString() ))
         {
-            // only add the specified base DN
-            DN dn = browserConnection.getBaseDN();
-            IEntry entry = new BaseDNEntry( new DN( dn ), browserConnection );
-            browserConnection.cacheEntry( entry );
-            browserConnection.getRootDSE().addChild( entry );
-            
-            // check if entry exists
-            // TODO: use browserConnection.getEntry( dn, monitor ) ??
-            search = new Search( null, browserConnection, dn, ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, SearchScope.OBJECT, 1, 0,
-                AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, true, true, null );
-            SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
+            try
+            {
+                // only add the specified base DN
+                LdapDN dn = browserConnection.getBaseDN();
+                IEntry entry = new BaseDNEntry( new LdapDN( dn ), browserConnection );
+                browserConnection.cacheEntry( entry );
+                browserConnection.getRootDSE().addChild( entry );
+                
+                // check if entry exists
+                // TODO: use browserConnection.getEntry( dn, monitor ) ??
+                search = new Search( null, browserConnection, dn, ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, SearchScope.OBJECT, 1, 0,
+                    AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, true, true, null );
+                SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
+            }
+            catch ( InvalidNameException e )
+            {
+                monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e );
+            }
         }
         else
         {
@@ -332,11 +340,11 @@
                 if ( !"".equals( namingContext ) ) { //$NON-NLS-1$
                     try
                     {
-                        IEntry entry = new BaseDNEntry( new DN( namingContext ), browserConnection );
+                        IEntry entry = new BaseDNEntry( new LdapDN( namingContext ), browserConnection );
                         browserConnection.getRootDSE().addChild( entry );
                         browserConnection.cacheEntry( entry );
                     }
-                    catch ( Exception e )
+                    catch ( InvalidNameException e )
                     {
                         monitor.reportError( BrowserCoreMessages.model__error_setting_base_dn, e );
                     }
@@ -344,7 +352,7 @@
                 else
                 {
                     // special handling of empty namingContext: perform a one-level search and add all result DNs to the set
-                    search = new Search( null, browserConnection, new DN(), ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, SearchScope.ONELEVEL, 0,
+                    search = new Search( null, browserConnection, LdapDN.EMPTY_LDAPDN, ISearch.FILTER_TRUE, ISearch.NO_ATTRIBUTES, SearchScope.ONELEVEL, 0,
                         0, AliasDereferencingMethod.NEVER, ReferralHandlingMethod.IGNORE, false, false, null );
                     SearchJob.searchAndUpdateModel( browserConnection, search, monitor );
                     ISearchResult[] results = search.getSearchResults();
@@ -390,7 +398,7 @@
 
     private static DirectoryMetadataEntry[] getDirectoryMetadataEntries( IBrowserConnection browserConnection, String metadataAttributeName )
     {
-        List<DN> metadataEntryList = new ArrayList<DN>();
+        List<LdapDN> metadataEntryList = new ArrayList<LdapDN>();
         IAttribute attribute = browserConnection.getRootDSE().getAttribute( metadataAttributeName );
         if ( attribute != null )
         {
@@ -399,9 +407,9 @@
             {
                 try
                 {
-                    metadataEntryList.add( new DN( values[i] ) );
+                    metadataEntryList.add( new LdapDN( values[i] ) );
                 }
-                catch ( NameException e )
+                catch ( InvalidNameException e )
                 {
                 }
             }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java Sun Nov  4 11:10:19 2007
@@ -115,9 +115,8 @@
 
         for ( int pi = 0; pi < entries.length && !monitor.isCanceled(); pi++ )
         {
-
             monitor.setTaskName( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_task, new String[]
-                { this.entries[pi].getDn().toString() } ) );
+                { this.entries[pi].getDn().getUpName() } ) );
             monitor.worked( 1 );
 
             if ( entries[pi].getBrowserConnection() != null && entries[pi].isDirectoryEntry() )
@@ -161,7 +160,7 @@
         {
             monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_sub,
                 new String[]
-                    { parent.getDn().toString() } ) );
+                    { parent.getDn().getUpName() } ) );
 
             // clear old children
             IEntry[] oldChildren = parent.getChildren();
@@ -199,7 +198,7 @@
             ISearchResult[] srs = search.getSearchResults();
             monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_subcount,
                 new String[]
-                    { srs == null ? Integer.toString( 0 ) : Integer.toString( srs.length ), parent.getDn().toString() } ) );
+                    { srs == null ? Integer.toString( 0 ) : Integer.toString( srs.length ), parent.getDn().getUpName() } ) );
 
             // fill children in search result
             if ( srs != null && srs.length > 0 )
@@ -264,7 +263,7 @@
                 monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_subcount,
                     new String[]
                         { subSrs == null ? Integer.toString( 0 ) : Integer.toString( subSrs.length ),
-                            parent.getDn().toString() } ) );
+                            parent.getDn().getUpName() } ) );
                 // fill children in search result
                 if ( subSrs != null && subSrs.length > 0 )
                 {

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ModifyValueJob.java Sun Nov  4 11:10:19 2007
@@ -160,7 +160,7 @@
         if ( browserConnection.getConnection() != null )
         {
             // dn
-            String dn = entry.getDn().toString();
+            String dn = entry.getDn().getUpName();
 
             // modification items
             // perform a replace if the current attribute is single-valued

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/MoveEntriesJob.java Sun Nov  4 11:10:19 2007
@@ -30,17 +30,18 @@
 import javax.naming.ldap.Control;
 import javax.naming.ldap.ManageReferralControl;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryMovedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
 
 
 /**
@@ -128,12 +129,12 @@
         {
             IEntry oldEntry = oldEntries[i];
             IEntry oldParent = oldEntry.getParententry();
-            DN newDn = new DN( oldEntry.getRdn(), newParent.getDn() );
+            LdapDN newDn = DnUtils.composeDn( oldEntry.getRdn(), newParent.getDn() );
 
             // move in directory
             // TODO: use manual/simulated move, if move of subtree is not supported (JNDI)
             int errorStatusSize1 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$
-            moveEntry( browserConnection, oldEntry, newDn.toString(), monitor );
+            moveEntry( browserConnection, oldEntry, newDn, monitor );
             //connection.move( oldEntry, newParent.getDn(), monitor );
             int errorStatusSize2 = monitor.getErrorStatus( "" ).getChildren().length; //$NON-NLS-1$
 
@@ -216,14 +217,15 @@
      * 
      * @param browserConnection the browser connection
      * @param oldEntry the old entry
-     * @param newDn the new dn
+     * @param newDn the new DN
      * @param monitor the progress monitor
      */
-    private void moveEntry( IBrowserConnection browserConnection, IEntry oldEntry, String newDn,
+    private void moveEntry( IBrowserConnection browserConnection, IEntry oldEntry, LdapDN newDn,
         StudioProgressMonitor monitor )
     {
         // dn
-        String oldDn = oldEntry.getDn().toString();
+        String oldDnString = oldEntry.getDn().getUpName();
+        String newDnString = newDn.getUpName();
 
         // controls
         Control[] controls = null;
@@ -233,7 +235,8 @@
                 { new ManageReferralControl() };
         }
 
-        browserConnection.getConnection().getJNDIConnectionWrapper().rename( oldDn, newDn, false, controls, monitor );
+        browserConnection.getConnection().getJNDIConnectionWrapper().rename( oldDnString, newDnString, false, controls,
+            monitor );
     }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReadEntryJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReadEntryJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReadEntryJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReadEntryJob.java Sun Nov  4 11:10:19 2007
@@ -21,10 +21,10 @@
 package org.apache.directory.studio.ldapbrowser.core.jobs;
 
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
@@ -48,7 +48,7 @@
     private IBrowserConnection browserConnection;
 
     /** The DN of the entry. */
-    private DN dn;
+    private LdapDN dn;
 
     /** The entry read from directory. */
     private IEntry readEntry;
@@ -60,7 +60,7 @@
      * @param browserConnection the browser connection
      * @param dn the DN of the entry
      */
-    public ReadEntryJob( IBrowserConnection browserConnection, DN dn )
+    public ReadEntryJob( IBrowserConnection browserConnection, LdapDN dn )
     {
         this.browserConnection = browserConnection;
         this.dn = dn;
@@ -145,7 +145,7 @@
      * 
      * @return the read entry
      */
-    static IEntry getEntry( IBrowserConnection browserConnection, DN dn, StudioProgressMonitor monitor )
+    static IEntry getEntry( IBrowserConnection browserConnection, LdapDN dn, StudioProgressMonitor monitor )
     {
         try
         {

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReloadSchemasJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReloadSchemasJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReloadSchemasJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReloadSchemasJob.java Sun Nov  4 11:10:19 2007
@@ -21,12 +21,12 @@
 package org.apache.directory.studio.ldapbrowser.core.jobs;
 
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
@@ -141,7 +141,7 @@
             if ( browserConnection.getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY ) != null )
             {
                 SearchParameter sp = new SearchParameter();
-                sp.setSearchBase( new DN( browserConnection.getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY )
+                sp.setSearchBase( new LdapDN( browserConnection.getRootDSE().getAttribute( IRootDSE.ROOTDSE_ATTRIBUTE_SUBSCHEMASUBENTRY )
                     .getStringValue() ) );
                 sp.setFilter( Schema.SCHEMA_FILTER );
                 sp.setScope( SearchScope.OBJECT );

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/RenameEntryJob.java Sun Nov  4 11:10:19 2007
@@ -29,18 +29,19 @@
 import javax.naming.ldap.Control;
 import javax.naming.ldap.ManageReferralControl;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.EntryRenamedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
-import org.apache.directory.studio.ldapbrowser.core.model.RDN;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
 
 
 /**
@@ -59,7 +60,7 @@
     private IEntry oldEntry;
 
     /** The new rdn. */
-    private RDN newRdn;
+    private Rdn newRdn;
 
     /** The delete old rdn flag. */
     private boolean deleteOldRdn;
@@ -78,7 +79,7 @@
      * @param newRdn the new rdn
      * @param deleteOldRdn the delete old rdn flag
      */
-    public RenameEntryJob( IEntry entry, RDN newRdn, boolean deleteOldRdn )
+    public RenameEntryJob( IEntry entry, Rdn newRdn, boolean deleteOldRdn )
     {
         this.browserConnection = entry.getBrowserConnection();
         this.oldEntry = entry;
@@ -117,17 +118,17 @@
     protected void executeNotificationJob( StudioProgressMonitor monitor )
     {
         monitor.beginTask( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__rename_entry_task, new String[]
-            { oldEntry.getDn().toString() } ), 3 );
+            { oldEntry.getDn().getUpName() } ), 3 );
         monitor.reportProgress( " " ); //$NON-NLS-1$
         monitor.worked( 1 );
 
         IEntry parent = oldEntry.getParententry();
-        DN newDn = new DN( newRdn, parent.getDn() );
+        LdapDN newDn = DnUtils.composeDn( newRdn, parent.getDn() );
 
         // rename in directory
         // TODO: use manual/simulated rename, if rename of subtree is not
         // supported
-        renameEntry( browserConnection, oldEntry, newDn.toString(), deleteOldRdn, monitor );
+        renameEntry( browserConnection, oldEntry, newDn, deleteOldRdn, monitor );
 
         if ( !monitor.errorsReported() )
         {
@@ -205,15 +206,16 @@
      * 
      * @param browserConnection the browser connection
      * @param oldEntry the old entry
-     * @param newDn the new dn
-     * @param deleteOldRdn the delete old rdn flag
+     * @param newDn the new DN
+     * @param deleteOldRdn the delete old RDN flag
      * @param monitor the progress monitor
      */
-    static void renameEntry( IBrowserConnection browserConnection, IEntry oldEntry, String newDn, boolean deleteOldRdn,
+    static void renameEntry( IBrowserConnection browserConnection, IEntry oldEntry, LdapDN newDn, boolean deleteOldRdn,
         StudioProgressMonitor monitor )
     {
         // dn
-        String oldDn = oldEntry.getDn().toString();
+        String oldDnString = oldEntry.getDn().getUpName();
+        String newDnString = newDn.getUpName();
 
         // controls
         Control[] controls = null;
@@ -223,7 +225,7 @@
                 { new ManageReferralControl() };
         }
 
-        browserConnection.getConnection().getJNDIConnectionWrapper().rename( oldDn, newDn, deleteOldRdn, controls,
+        browserConnection.getConnection().getJNDIConnectionWrapper().rename( oldDnString, newDnString, deleteOldRdn, controls,
             monitor );
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchJob.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchJob.java Sun Nov  4 11:10:19 2007
@@ -37,6 +37,7 @@
 import javax.naming.ldap.BasicControl;
 import javax.naming.ldap.Control;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
@@ -44,7 +45,6 @@
 import org.apache.directory.studio.ldapbrowser.core.events.SearchUpdateEvent;
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.ConnectionException;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
@@ -58,6 +58,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Entry;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.core.utils.DnUtils;
 import org.apache.directory.studio.ldapbrowser.core.utils.JNDIUtils;
 import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
 
@@ -186,7 +187,7 @@
                     while ( !monitor.isCanceled() && enumeration.hasMore() )
                     {
                         SearchResult sr = enumeration.nextElement(); // TODO: referrals exception
-                        DN dn = JNDIUtils.getDn( sr );
+                        LdapDN dn = JNDIUtils.getDn( sr );
 
                         // get entry from cache or create it
                         IEntry entry = browserConnection.getEntryFromCache( dn );
@@ -271,7 +272,7 @@
     static NamingEnumeration<SearchResult> search( IBrowserConnection browserConnection, SearchParameter parameter,
         StudioProgressMonitor monitor )
     {
-        String searchBase = parameter.getSearchBase().toString();
+        String searchBase = parameter.getSearchBase().getUpName();
         SearchControls controls = new SearchControls();
         switch ( parameter.getScope() )
         {
@@ -466,28 +467,29 @@
      * 
      * @return the created entry
      */
-    private static IEntry createAndCacheEntry( IBrowserConnection browserConnection, DN dn )
+    private static IEntry createAndCacheEntry( IBrowserConnection browserConnection, LdapDN dn )
     {
         IEntry entry = null;
 
         // build tree to parent
-        LinkedList<DN> parentDnList = new LinkedList<DN>();
-        DN parentDN = dn;
+        LinkedList<LdapDN> parentDnList = new LinkedList<LdapDN>();
+        LdapDN parentDN = dn;
         while ( parentDN != null && browserConnection.getEntryFromCache( parentDN ) == null )
         {
             parentDnList.addFirst( parentDN );
-            parentDN = parentDN.getParentDn();
+            parentDN = DnUtils.getParent( parentDN );
         }
-        for ( DN aDN : parentDnList )
+        for ( LdapDN aDN : parentDnList )
         {
-            if ( aDN.getParentDn() == null )
+            parentDN = DnUtils.getParent( aDN );
+            if ( parentDN == null )
             {
                 entry = new BaseDNEntry( aDN, browserConnection );
                 browserConnection.cacheEntry( entry );
             }
-            else if ( browserConnection.getEntryFromCache( aDN.getParentDn() ) != null )
+            else if ( browserConnection.getEntryFromCache( parentDN ) != null )
             {
-                IEntry parentEntry = browserConnection.getEntryFromCache( aDN.getParentDn() );
+                IEntry parentEntry = browserConnection.getEntryFromCache( parentDN );
                 entry = new Entry( parentEntry, aDN.getRdn() );
                 entry.setDirectoryEntry( true );
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/BookmarkParameter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/BookmarkParameter.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/BookmarkParameter.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/BookmarkParameter.java Sun Nov  4 11:10:19 2007
@@ -23,6 +23,10 @@
 
 import java.io.Serializable;
 
+import javax.naming.InvalidNameException;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+
 
 /**
  * A Bean class to hold the bookmark parameters. 
@@ -38,7 +42,7 @@
     private static final long serialVersionUID = 105108281861642267L;
 
     /** The target DN. */
-    private DN dn;
+    private LdapDN dn;
 
     /** The symbolic name. */
     private String name;
@@ -58,7 +62,7 @@
      * @param dn the target DN
      * @param name the symbolic name
      */
-    public BookmarkParameter( DN dn, String name )
+    public BookmarkParameter( LdapDN dn, String name )
     {
         this.dn = dn;
         this.name = name;
@@ -70,7 +74,7 @@
      * 
      * @return the target DN
      */
-    public DN getDn()
+    public LdapDN getDn()
     {
         return dn;
     }
@@ -81,12 +85,34 @@
      * 
      * @param dn the target DN
      */
-    public void setDn( DN dn )
+    public void setDn( LdapDN dn )
     {
         this.dn = dn;
     }
 
 
+    /**
+     * Sets the target DN.
+     * 
+     *  * @deprecated This method will be removed in the next version. The DN/RDN/RDNPart 
+     * classes are replaced with the shared-ldap LdapDN/Rdn/ATAV. This method just 
+     * remains to provide backward compatibility of the old browserconnections.xml
+     * file that stores searches and bookmarks.
+     * 
+     * @param dn the target DN
+     */
+    public void setDn( DN dn )
+    {
+        try
+        {
+            setDn( new LdapDN( dn.toString() ) );
+        }
+        catch ( InvalidNameException e )
+        {
+        }
+    }
+    
+    
     /**
      * Gets the symbolic name.
      * 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/DN.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/DN.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/DN.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/DN.java Sun Nov  4 11:10:19 2007
@@ -32,6 +32,11 @@
 /**
  * A DN represents a LDAP distinguished name.
  *
+ * @deprecated This class will be removed in the next version. The DN/RDN/RDNPart 
+ * classes are replaced with the shared-ldap LdapDN/Rdn/ATAV. This class just 
+ * remains to provide backward compatibility of the old browserconnections.xml
+ * file that stores searches and bookmarks.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBookmark.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBookmark.java?rev=591817&r1=591816&r2=591817&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBookmark.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBookmark.java Sun Nov  4 11:10:19 2007
@@ -23,6 +23,7 @@
 
 import java.io.Serializable;
 
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.core.ConnectionPropertyPageProvider;
 import org.apache.directory.studio.ldapbrowser.core.propertypageproviders.BookmarkPropertyPageProvider;
 import org.apache.directory.studio.ldapbrowser.core.propertypageproviders.EntryPropertyPageProvider;
@@ -45,7 +46,7 @@
      * 
      * @return the DN
      */
-    public DN getDn();
+    public LdapDN getDn();
 
 
     /**
@@ -53,7 +54,7 @@
      * 
      * @param dn the DN
      */
-    public void setDn( DN dn );
+    public void setDn( LdapDN dn );
 
 
     /**



Mime
View raw message