directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r477673 - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser: controller/actions/ view/views/ view/views/wrappers/
Date Tue, 21 Nov 2006 14:01:24 GMT
Author: pamarcelot
Date: Tue Nov 21 06:01:21 2006
New Revision: 477673

URL: http://svn.apache.org/viewvc?view=rev&rev=477673
Log:
Moving the DSMLv2Engine into the ConnectionWrapper class as a field. Other classes access
this DSMLV2Engine using the getDsmlv2Engine() method of this class. This way we avoid creating
a new DSMLv2Engine each time we need to send DSML to the server.

Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RefreshAction.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributeAddWizardPage.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/AttributeDeleteAction.java
Tue Nov 21 06:01:21 2006
@@ -24,11 +24,13 @@
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.ldapstudio.browser.Activator;
-import org.apache.directory.ldapstudio.browser.model.Connection;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.AttributesView;
 import org.apache.directory.ldapstudio.browser.view.views.BrowserView;
 import org.apache.directory.ldapstudio.browser.view.views.wrappers.EntryWrapper;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
+import org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine;
+import org.apache.directory.ldapstudio.dsmlv2.reponse.ErrorResponse;
 import org.apache.directory.shared.ldap.codec.LdapResponse;
 import org.apache.directory.shared.ldap.codec.modify.ModifyResponse;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
@@ -38,9 +40,6 @@
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
-import org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine;
-import org.apache.directory.ldapstudio.dsmlv2.reponse.ErrorResponse;
 
 
 /**
@@ -77,11 +76,9 @@
             EntryWrapper entryWrapper = ( EntryWrapper ) ( ( TreeSelection ) browserView.getViewer().getSelection()
)
                 .getFirstElement();
             SearchResultEntry entry = entryWrapper.getEntry();
-            Connection connection = entryWrapper.getConnection();
 
             // Initialization of the DSML Engine and the DSML Response Parser
-            Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection.getUserDN()
-                .getNormName(), connection.getPassword() );
+            Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
             Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
             String request = "<batchRequest>" + "	<modifyRequest dn=\""

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/ConnectionEditAction.java
Tue Nov 21 06:01:21 2006
@@ -80,8 +80,8 @@
 
         // Updating the state of the Connection since it has changed (this causes the icon
to change)
         connectionWrapper.setHasError( false );
-
+        connectionWrapper.connectionChanged();
+        
         selectedConnection.notifyListeners();
-
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RefreshAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RefreshAction.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RefreshAction.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/actions/RefreshAction.java
Tue Nov 21 06:01:21 2006
@@ -22,12 +22,15 @@
 
 
 import org.apache.directory.ldapstudio.browser.Activator;
-import org.apache.directory.ldapstudio.browser.model.Connection;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.AttributesView;
 import org.apache.directory.ldapstudio.browser.view.views.BrowserView;
 import org.apache.directory.ldapstudio.browser.view.views.wrappers.ConnectionWrapper;
 import org.apache.directory.ldapstudio.browser.view.views.wrappers.EntryWrapper;
+import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
+import org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine;
+import org.apache.directory.ldapstudio.dsmlv2.reponse.ErrorResponse;
+import org.apache.directory.ldapstudio.dsmlv2.reponse.SearchResponse;
 import org.apache.directory.shared.ldap.codec.LdapResponse;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
 import org.eclipse.jface.action.Action;
@@ -36,10 +39,6 @@
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
-import org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine;
-import org.apache.directory.ldapstudio.dsmlv2.reponse.ErrorResponse;
-import org.apache.directory.ldapstudio.dsmlv2.reponse.SearchResponse;
 
 
 /**
@@ -93,11 +92,8 @@
     {
         try
         {
-            Connection connection = entryWrapper.getConnection();
-
             // Initialization of the DSML Engine and the DSML Response Parser
-            Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection.getUserDN()
-                .getNormName(), connection.getPassword() );
+            Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
             Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
             String request = "<batchRequest>" + "	<searchRequest dn=\""

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributeAddWizardPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributeAddWizardPage.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributeAddWizardPage.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributeAddWizardPage.java
Tue Nov 21 06:01:21 2006
@@ -26,7 +26,6 @@
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.ldapstudio.browser.Activator;
-import org.apache.directory.ldapstudio.browser.model.Connection;
 import org.apache.directory.ldapstudio.browser.view.ImageKeys;
 import org.apache.directory.ldapstudio.browser.view.views.wrappers.EntryWrapper;
 import org.apache.directory.ldapstudio.dsmlv2.Dsmlv2ResponseParser;
@@ -303,12 +302,10 @@
 
             EntryWrapper entryWrapper = ( EntryWrapper ) ( ( TreeSelection ) browserView.getViewer().getSelection()
)
                 .getFirstElement();
-            Connection connection = entryWrapper.getConnection();
             SearchResultEntry entry = entryWrapper.getEntry();
 
             // Initialization of the DSML Engine and the DSML Response Parser
-            Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection.getUserDN()
-                .getNormName(), connection.getPassword() );
+            Dsmlv2Engine engine = entryWrapper.getDsmlv2Engine();
             Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
             String request = "<batchRequest>" + "	<modifyRequest dn=\""

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java
Tue Nov 21 06:01:21 2006
@@ -57,6 +57,8 @@
     /** The hasError Flag */
     private boolean hasError = false;
 
+    private Dsmlv2Engine engine;
+
 
     public ConnectionWrapper( Connection connection )
     {
@@ -140,9 +142,13 @@
 
             try
             {
-                // Initialization of the DSML Engine and the DSML Response Parser
-                Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection
-                    .getUserDN().getNormName(), connection.getPassword() );
+                if ( engine == null )
+                {
+                    // Initialization of the DSML Engine and the DSML Response Parser
+                    engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection
+                        .getUserDN().getNormName(), connection.getPassword() );
+                }
+                
                 Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
                 String request = "<batchRequest>" + "	<searchRequest dn=\"" + connection.getBaseDN().getNormName()
@@ -234,6 +240,15 @@
     {
         children = null;
     }
+    
+    /**
+     * Erases the Children List and the Dsmlv2 Engine
+     */
+    public void connectionChanged()
+    {
+        clearChildren();
+        engine = null;
+    }
 
 
     /**
@@ -253,5 +268,14 @@
     public void setHasError( boolean hasError )
     {
         this.hasError = hasError;
+    }
+    
+    /**
+     * Gets the Dsmlv2Engine
+     * @return the Dsmlv2Engine
+     */
+    public Dsmlv2Engine getDsmlv2Engine()
+    {
+        return this.engine;
     }
 }

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java?view=diff&rev=477673&r1=477672&r2=477673
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/EntryWrapper.java
Tue Nov 21 06:01:21 2006
@@ -234,8 +234,7 @@
             try
             {
                 // Initialization of the DSML Engine and the DSML Response Parser
-                Dsmlv2Engine engine = new Dsmlv2Engine( getConnection().getHost(), getConnection().getPort(),
-                    getConnection().getUserDN().getNormName(), getConnection().getPassword()
);
+                Dsmlv2Engine engine = getDsmlv2Engine();
                 Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser();
 
                 String request = "<batchRequest>" + "	<searchRequest dn=\"" + getEntry().getObjectName().getNormName()
@@ -310,10 +309,33 @@
     }
 
 
+    /**
+     * Erases the Children List
+     */
     public void clearChildren()
     {
         children = null;
         hasChildren = true;
     }
 
+    
+    /**
+     * Gets the Dsmlv2Engine
+     * @return the Dsmlv2Engine
+     */
+    public Dsmlv2Engine getDsmlv2Engine()
+    {
+        Object parent = getParent();
+        
+        if ( parent instanceof EntryWrapper )
+        {
+            return ( ( EntryWrapper ) parent ).getDsmlv2Engine();
+        }
+        else if ( parent instanceof ConnectionWrapper )
+        {
+            return ( ( ConnectionWrapper ) parent ).getDsmlv2Engine();
+        }
+        
+        return null;
+    }
 }



Mime
View raw message