directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r571334 - in /directory/studio/trunk: studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ studio...
Date Thu, 30 Aug 2007 22:13:31 GMT
Author: seelmann
Date: Thu Aug 30 15:13:30 2007
New Revision: 571334

URL: http://svn.apache.org/viewvc?rev=571334&view=rev
Log:
Added schema cache

Added:
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
Modified:
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserConnectionManager.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/AbstractEntry.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/AbstractEclipseJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/CreateEntryJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ReloadSchemasJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/SearchJob.java
    directory/studio/trunk/studio-ldapbrowser-core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/RootDSEPropertyPage.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaPropertyPage.java

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/properties/ConnectionPropertyPage.java
Thu Aug 30 15:13:30 2007
@@ -207,6 +207,7 @@
         boolean parametersModified = false;
         boolean reconnectionRequired = false;
         ConnectionParameter connectionParameter = new ConnectionParameter();
+        connectionParameter.setId( connection.getConnectionParameter().getId() );
         for ( int i = 0; i < pages.length; i++ )
         {
             pages[i].saveParameters( connectionParameter );

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
Thu Aug 30 15:13:30 2007
@@ -402,7 +402,9 @@
         boolean fetchBaseDns = connectionParameter
             .getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_BASE_DNS
);
         String baseDn = connectionParameter.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_BASE_DN
);
-        return fetchBaseDns != isAutoFetchBaseDns() || !( baseDn.equals( getBaseDN() ) );
+        return fetchBaseDns != isAutoFetchBaseDns() || ( baseDn == null && getBaseDN()
!= null )
+            || ( baseDn != null && getBaseDN() == null )
+            || ( baseDn != getBaseDN() && !( baseDn.equals( getBaseDN() ) ) );
     }
 
 }

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=571334&r1=571333&r2=571334&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
Thu Aug 30 15:13:30 2007
@@ -29,6 +29,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.HashMap;
@@ -42,6 +43,8 @@
 import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
 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;
+import org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateListener;
 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.events.SearchUpdateListener;
@@ -53,6 +56,7 @@
 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.SearchParameter;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
 import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
 import org.eclipse.core.runtime.IPath;
 
@@ -63,7 +67,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BrowserConnectionManager implements ConnectionUpdateListener, SearchUpdateListener,
BookmarkUpdateListener
+public class BrowserConnectionManager implements ConnectionUpdateListener, BrowserConnectionUpdateListener,
SearchUpdateListener, BookmarkUpdateListener
 {
 
     /** The list of connections. */
@@ -80,33 +84,34 @@
         ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner()
);
         EventRegistry.addSearchUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner()
);
         EventRegistry.addBookmarkUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner()
);
+        EventRegistry.addBrowserConnectionUpdateListener( this, BrowserCorePlugin.getDefault().getEventRunner()
);
     }
 
 
     /**
-     * Gets the Schema Cache filename for the corresponding Connection name.
+     * Gets the Schema Cache filename for the corresponding browser connection.
      *
-     * @param connectionName
-     *      the connection name
+     * @param browserConnection
+     *      the browser connection
      * @return
-     *      the Schema Cache filename for the corresponding Connection name
+     *      the Schema Cache filename for the corresponding browser connection
      */
-    public static final String getSchemaCacheFileName( String connectionName )
+    public static final String getSchemaCacheFileName( IBrowserConnection browserConnection
)
     {
         return BrowserCorePlugin.getDefault().getStateLocation().append(
-            "schema-" + toSaveString( connectionName ) + ".ldif" ).toOSString(); //$NON-NLS-1$
//$NON-NLS-2$
+            "schema-" + toSaveString( browserConnection.getConnection().getId() ) + ".ldif"
).toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 
     /**
-     * Gets the Modification Log filename for the corresponding Connection name.
+     * Gets the Modification Log filename for the corresponding browser connection.
      *
-     * @param connectionName
-     *      the connection name
+     * @param browserConnection
+     *      the browser connection
      * @return
      *      the Modification Log filename
      */
-    public static final String getModificationLogFileName( String connectionName )
+    public static final String getModificationLogFileName( IBrowserConnection browserConnection
)
     {
         IPath p = BrowserCorePlugin.getDefault().getStateLocation().append( "logs" ); //$NON-NLS-1$
         File file = p.toFile();
@@ -114,7 +119,8 @@
         {
             file.mkdir();
         }
-        return p.append( "modifications-" + toSaveString( connectionName ) + "-%u-%g.ldiflog"
).toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+        return p
+            .append( "modifications-" + toSaveString( browserConnection.getConnection().getId()
) + "-%u-%g.ldiflog" ).toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 
@@ -203,20 +209,6 @@
     }
 
 
-//    /**
-//     * Gets a connection from its name.
-//     *
-//     * @param name
-//     *      the name of the Connection
-//     * @return
-//     *      the corresponding IConnection
-//     */
-//    public IBrowserConnection getConnectionByName( String name )
-//    {
-//        return connectionMap.get( name );
-//    }
-    
-    
     /**
      * Gets a browser connection from its id.
      *
@@ -278,10 +270,10 @@
     public void connectionRemoved( Connection connection )
     {
         // update connection list
-        connectionMap.remove( connection.getId() );
+        IBrowserConnection browserConnection = connectionMap.remove( connection.getId() );
 
         // remove schema file
-        File schemaFile = new File( getSchemaCacheFileName( connection.getId() ) );
+        File schemaFile = new File( getSchemaCacheFileName( browserConnection ) );
         if ( schemaFile.exists() )
         {
             schemaFile.delete();
@@ -312,6 +304,7 @@
     public void connectionUpdated( Connection connection )
     {
         saveBrowserConnections();
+        saveSchema( getBrowserConnection( connection ) );
     }
 
 
@@ -330,6 +323,19 @@
     {
     }
 
+ 
+    /**
+     * @see org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateListener#browserConnectionUpdated(org.apache.directory.studio.ldapbrowser.core.events.BrowserConnectionUpdateEvent)
+     */
+    public void browserConnectionUpdated( BrowserConnectionUpdateEvent browserConnectionUpdateEvent
)
+    {
+        if ( browserConnectionUpdateEvent.getDetail() == BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED
+            || browserConnectionUpdateEvent.getDetail() == BrowserConnectionUpdateEvent.Detail.SCHEMA_UPDATED
)
+        {
+            saveSchema( browserConnectionUpdateEvent.getBrowserConnection() );
+        }
+    }
+
 
     /**
      * {@inheritDoc}
@@ -405,7 +411,7 @@
     {
         try
         {
-            String filename = getSchemaCacheFileName( connection.getConnection().getId()
);
+            String filename = getSchemaCacheFileName( connection );
             FileWriter writer = new FileWriter( filename );
             connection.getSchema().saveToLdif( writer );
             writer.close();
@@ -428,22 +434,20 @@
             Connection connection = connections[i];
             BrowserConnection browserConnection = new BrowserConnection( connection );
             connectionMap.put( connection.getId(), browserConnection );
+            
+            try
+            {
+                String schemaFilename = getSchemaCacheFileName( browserConnection );
+                FileReader reader = new FileReader( schemaFilename );
+                Schema schema = new Schema();
+                schema.loadFromLdif( reader );
+                browserConnection.setSchema( schema );
+            }
+            catch ( Exception e )
+            {
+            }
         }
-
-        //        try
-        //        {
-        //            String schemaFilename = getSchemaCacheFileName( conn.getName() );
-        //            FileReader reader = new FileReader( schemaFilename );
-        //            Schema schema = new Schema();
-        //            schema.loadFromLdif( reader );
-        //            conn.setSchema( schema );
-        //        }
-        //        catch ( Exception e )
-        //        {
-        //        }
         
-//        connectionList.clear();
-//        
         try
         {
             Object[][] object = ( Object[][] ) this.load( getBrowserConnectionStoreFileName()
);

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/BrowserCorePlugin.java
Thu Aug 30 15:13:30 2007
@@ -23,7 +23,6 @@
 
 import org.apache.directory.studio.ldapbrowser.core.events.CoreEventRunner;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRunner;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IReferralHandler;
 import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;

Added: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java?rev=571334&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
(added)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateEvent.java
Thu Aug 30 15:13:30 2007
@@ -0,0 +1,92 @@
+/*
+ *  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.studio.ldapbrowser.core.events;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * An BrowserConnectionUpdateEvent indicates that an {@link IBrowserConnection} was modified.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserConnectionUpdateEvent
+{
+
+    /**
+     * Contains constants to specify the event detail.
+     */
+    public enum Detail
+    {
+        /** Indicates that the browser connection was opened. */
+        BROWSER_CONNECTION_OPENED,
+
+        /** Indicates that the browser connection was closed. */
+        BROWSER_CONNECTION_CLOSED,
+
+        /** Indicates that the schema was updated. */
+        SCHEMA_UPDATED
+    }
+
+    /** The event detail. */
+    private Detail detail;
+
+    /** The updated browser connection. */
+    private IBrowserConnection browserConnection;
+
+
+    /**
+     * Creates a new instance of BrowserConnectionUpdateEvent.
+     *
+     * @param browserConnection the updated browser connection
+     * @param detail the event detail
+     */
+    public BrowserConnectionUpdateEvent( IBrowserConnection browserConnection, Detail detail
)
+    {
+        this.browserConnection = browserConnection;
+        this.detail = detail;
+    }
+
+
+    /**
+     * Gets the updated browser connection.
+     *
+     * @return the updated browser connection
+     */
+    public IBrowserConnection getBrowserConnection()
+    {
+        return browserConnection;
+    }
+
+
+    /**
+     * Gets the event detail.
+     *
+     * @return the event detail
+     */
+    public Detail getDetail()
+    {
+        return detail;
+    }
+
+}

Added: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java?rev=571334&view=auto
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
(added)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/BrowserConnectionUpdateListener.java
Thu Aug 30 15:13:30 2007
@@ -0,0 +1,45 @@
+/*
+ *  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.studio.ldapbrowser.core.events;
+
+
+import java.util.EventListener;
+
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+
+
+/**
+ * A listener for {@link BrowserConnectionUpdateEvent}s
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface BrowserConnectionUpdateListener extends EventListener
+{
+
+    /**
+     * Called when an {@link IBrowserConnection} was updated.
+     *
+     * @param browserConnectionUpdateEvent the browser connection update event
+     */
+    public void browserConnectionUpdated( BrowserConnectionUpdateEvent browserConnectionUpdateEvent
);
+
+}

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
Thu Aug 30 15:13:30 2007
@@ -218,10 +218,82 @@
     }
 
     /** The map with entry update listeners and their runners */
-    private static Map<EntryUpdateListener, EventRunner> entryUpdateListeners = new
HashMap<EntryUpdateListener, EventRunner>();
+    private static Map<BrowserConnectionUpdateListener, EventRunner> browserConnectionUpdateListeners
= new HashMap<BrowserConnectionUpdateListener, EventRunner>();
+
+
+    /**
+     * Adds the browser connection update listener.
+     *
+     * @param listener the listener
+     * @param runner the runner
+     */
+    public static void addBrowserConnectionUpdateListener( BrowserConnectionUpdateListener
listener, EventRunner runner )
+    {
+        assert listener != null;
+        assert runner != null;
+
+        if ( !browserConnectionUpdateListeners.containsKey( listener ) )
+        {
+            browserConnectionUpdateListeners.put( listener, runner );
+        }
+    }
+
+
+    /**
+     * Removes the browser connection update listener.
+     *
+     * @param listener the listener
+     */
+    public static void removeBrowserConnectionpdateListener( BrowserConnectionUpdateListener
listener )
+    {
+        if ( browserConnectionUpdateListeners.containsKey( listener ) )
+        {
+            browserConnectionUpdateListeners.remove( listener );
+        }
+    }
 
 
     /**
+     * Notifies each {@link BrowserConnectionUpdateListener} about the the given {@link BrowserConnectionUpdateEvent}.
+     * Uses the {@link EventRunner}s.
+     *
+     * @param browserConnectionUpdateEvent the browser connection update event
+     * @param source the source
+     */
+    public static void fireBrowserConnectionUpdated( final BrowserConnectionUpdateEvent browserConnectionUpdateEvent,
+        final Object source )
+    {
+        if( isEventFireingSuspendedInCurrentThread() )
+        {
+            return;
+        }
+
+        Iterator<BrowserConnectionUpdateListener> it = browserConnectionUpdateListeners.keySet().iterator();
+        while( it.hasNext() )
+        {
+            final BrowserConnectionUpdateListener listener = it.next();
+            EventRunnable runnable = new EventRunnable()
+            {
+                public void run()
+                {
+                    listener.browserConnectionUpdated( browserConnectionUpdateEvent );
+                }
+            };
+
+            EventRunner runner = browserConnectionUpdateListeners.get( listener );
+            synchronized( lock )
+            {
+                runner.execute( runnable );
+            }
+        }
+    }
+
+
+    /** The map with entry update listeners and their runners */
+    private static Map<EntryUpdateListener, EventRunner> entryUpdateListeners = new
HashMap<EntryUpdateListener, EventRunner>();
+    
+    
+    /**
      * Adds the entry update listener.
      *
      * @param listener the listener
@@ -231,14 +303,14 @@
     {
         assert listener != null;
         assert runner != null;
-
+        
         if ( !entryUpdateListeners.containsKey( listener ) )
         {
             entryUpdateListeners.put( listener, runner );
         }
     }
-
-
+    
+    
     /**
      * Removes the entry update listener.
      *
@@ -251,8 +323,8 @@
             entryUpdateListeners.remove( listener );
         }
     }
-
-
+    
+    
     /**
      * Notifies each {@link EntryUpdateListener} about the the given {@link EntryModificationEvent}.
      * Uses the {@link EventRunner}s.
@@ -266,7 +338,7 @@
         {
             return;
         }
-
+        
         Iterator<EntryUpdateListener> it = entryUpdateListeners.keySet().iterator();
         while( it.hasNext() )
         {
@@ -278,7 +350,7 @@
                     listener.entryUpdated( entryUpdateEvent );
                 }
             };
-
+            
             EventRunner runner = entryUpdateListeners.get( listener );
             synchronized( lock )
             {
@@ -286,6 +358,6 @@
             }
         }
     }
-
-
+    
+    
 }

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/AbstractEntry.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/AbstractEntry.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/AbstractEntry.java
Thu Aug 30 15:13:30 2007
@@ -30,8 +30,6 @@
 import java.util.Map;
 
 import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.event.ConnectionUpdateListener;
-import org.apache.directory.studio.connection.core.event.EventRunner;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.AttributeAddedEvent;
 import org.apache.directory.studio.ldapbrowser.core.events.AttributeDeletedEvent;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/BrowserConnection.java
Thu Aug 30 15:13:30 2007
@@ -39,7 +39,10 @@
 import org.apache.directory.studio.ldapbrowser.core.BookmarkManager;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.SearchManager;
+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.internal.search.LdapSearchPageScoreComputer;
+import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesJob;
 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;
@@ -150,7 +153,7 @@
      */
     public void reloadSchema( StudioProgressMonitor monitor )
     {
-        fetchRootDSE( monitor );
+        InitializeAttributesJob.initializeAttributes( getRootDSE(), true, monitor );
         
         monitor.reportProgress( BrowserCoreMessages.model__loading_schema );
         loadSchema( monitor );
@@ -1034,6 +1037,9 @@
         if(this.connection == connection)
         {
             new OpenBrowserConnectionsJob( this ).execute();
+            BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent(
this,
+                BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED );
+            EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent , this
);
         }
     }
     public void connectionClosed( org.apache.directory.studio.connection.core.Connection
connection )
@@ -1041,6 +1047,9 @@
         if(this.connection == connection)
         {
             close();
+            BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent(
this,
+                BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_CLOSED );
+            EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent , this
);
         }
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
Thu Aug 30 15:13:30 2007
@@ -42,10 +42,7 @@
 import javax.naming.ldap.Control;
 
 import org.apache.directory.studio.connection.core.Connection;
-import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
-import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
-import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
 import org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreConstants;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ModificationLogger.java
Thu Aug 30 15:13:30 2007
@@ -55,7 +55,7 @@
         this.logger = Logger.getAnonymousLogger();
         this.logger.setLevel( Level.ALL );
 
-        String logfileName = BrowserConnectionManager.getModificationLogFileName( connection.getName()
);
+        String logfileName = BrowserConnectionManager.getModificationLogFileName( connection
);
         try
         {
             fileHandler = new FileHandler( logfileName, 100000, 10, true );

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=571334&r1=571333&r2=571334&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
Thu Aug 30 15:13:30 2007
@@ -26,7 +26,6 @@
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
-import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 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;

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=571334&r1=571333&r2=571334&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
Thu Aug 30 15:13:30 2007
@@ -21,10 +21,6 @@
 package org.apache.directory.studio.ldapbrowser.core.jobs;
 
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsJob.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsJob.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/FetchBaseDNsJob.java
Thu Aug 30 15:13:30 2007
@@ -27,10 +27,8 @@
 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.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;
 
 

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=571334&r1=571333&r2=571334&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
Thu Aug 30 15:13:30 2007
@@ -27,7 +27,10 @@
 
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.StudioProgressMonitor;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 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.IBrowserConnection;
 
 
@@ -82,11 +85,11 @@
 
     protected void runNotification()
     {
-        for ( int i = 0; i < browserConnections.length; i++ )
+        for ( IBrowserConnection browserConnection : browserConnections )
         {
-            // TODO: schema update event
-//            EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( connections[i],
-//                ConnectionUpdateEvent.EventDetail.SCHEMA_LOADED ), this );
+            BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent(
+                browserConnection, BrowserConnectionUpdateEvent.Detail.SCHEMA_UPDATED );
+            EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent, this
);
         }
     }
 

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=571334&r1=571333&r2=571334&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
Thu Aug 30 15:13:30 2007
@@ -30,7 +30,6 @@
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 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.IBrowserConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/test/java/org/apache/directory/studio/ldapbrowser/core/model/PasswordTest.java
Thu Aug 30 15:13:30 2007
@@ -20,8 +20,6 @@
 
 package org.apache.directory.studio.ldapbrowser.core.model;
 
-import org.apache.directory.studio.ldapbrowser.core.model.Password;
-
 import junit.framework.TestCase;
 
 /**

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/RootDSEPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/RootDSEPropertyPage.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/RootDSEPropertyPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/RootDSEPropertyPage.java
Thu Aug 30 15:13:30 2007
@@ -27,8 +27,11 @@
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
+import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetTableMetadata;
+import org.apache.directory.studio.ldapbrowser.core.BrowserConnectionManager;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
 import org.apache.directory.studio.ldapbrowser.core.internal.model.RootDSE;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
@@ -102,12 +105,17 @@
     
     static IBrowserConnection getConnection( Object element )
     {
-        IBrowserConnection connection = null;
+        IBrowserConnection browserConnection = null;
         if ( element instanceof IAdaptable )
         {
-            connection = ( IBrowserConnection ) ( ( IAdaptable ) element ).getAdapter( IBrowserConnection.class
);
+            browserConnection = ( IBrowserConnection ) ( ( IAdaptable ) element ).getAdapter(
IBrowserConnection.class );
+            if(browserConnection == null)
+            {
+                Connection connection = ( Connection ) ( ( IAdaptable ) element ).getAdapter(
Connection.class );
+                browserConnection = BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnection(
connection );
+            }
         }
-        return connection;
+        return browserConnection;
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaPropertyPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaPropertyPage.java?rev=571334&r1=571333&r2=571334&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaPropertyPage.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/properties/SchemaPropertyPage.java
Thu Aug 30 15:13:30 2007
@@ -188,7 +188,7 @@
 
             if ( connection != null )
             {
-                String cacheFileName = BrowserConnectionManager.getSchemaCacheFileName( connection.getName()
);
+                String cacheFileName = BrowserConnectionManager.getSchemaCacheFileName( connection
);
                 File cacheFile = new File( cacheFileName );
                 if ( cacheFile.exists() )
                 {



Mime
View raw message