directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r513220 - in /directory/ldapstudio/trunk/ldapstudio-proxy: ./ META-INF/ src/main/java/org/apache/directory/ldapstudio/proxy/controller/ src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ src/main/java/org/apache/directo...
Date Thu, 01 Mar 2007 08:01:03 GMT
Author: pamarcelot
Date: Thu Mar  1 00:01:02 2007
New Revision: 513220

URL: http://svn.apache.org/viewvc?view=rev&rev=513220
Log:
Added TreeViewer instead of Tree in the Proxy View (with Content and Label Providers). Proxy View now displays the messages received from the LDAP Server.

Added:
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapMessageWithPDU.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewContentProvider.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewLabelProvider.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/AbstractWrapper.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/IWrapper.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapMessageWrapper.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapProxyWrapper.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-proxy/.classpath
    directory/ldapstudio/trunk/ldapstudio-proxy/META-INF/MANIFEST.MF
    directory/ldapstudio/trunk/ldapstudio-proxy/build.properties
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/ProxyViewController.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ConnectAction.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/DisconnectAction.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxy.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyListener.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyThread.java
    directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyView.java

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/.classpath
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/.classpath?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/.classpath (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/.classpath Thu Mar  1 00:01:02 2007
@@ -3,5 +3,8 @@
 	<classpathentry kind="src" path="src/main/java"/>
 	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>	<classpathentry kind="output" path="target/classes"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="lib" path="lib/shared-ldap-0.9.6-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/shared-asn1-0.9.6-SNAPSHOT.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/META-INF/MANIFEST.MF?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/META-INF/MANIFEST.MF (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/META-INF/MANIFEST.MF Thu Mar  1 00:01:02 2007
@@ -12,4 +12,9 @@
  org.apache.directory.ldapstudio.browser.ui;resolution:=optional,
  org.apache.directory.ldapstudio.browser.core;resolution:=optional
 Eclipse-LazyStart: true
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ lib/shared-ldap-0.9.6-SNAPSHOT.jar,
+ lib/shared-asn1-0.9.6-SNAPSHOT.jar,
+ lib/nlog4j-1.2.24.jar,
+ lib/commons-collections-3.1.jar,
+ lib/antlr-2.7.6.jar

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/build.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/build.properties?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/build.properties (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/build.properties Thu Mar  1 00:01:02 2007
@@ -3,4 +3,10 @@
 output.. = bin/
 bin.includes = META-INF/,\
                .,\
-               plugin.xml
\ No newline at end of file
+               plugin.xml,\
+               lib/shared-ldap-0.9.6-SNAPSHOT.jar,\
+               lib/shared-asn1-0.9.6-SNAPSHOT.jar,\
+               lib/nlog4j-1.2.24.jar,\
+               lib/commons-collections-3.1.jar,\
+               lib/antlr-2.7.6.jar
+

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/ProxyViewController.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/ProxyViewController.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/ProxyViewController.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/ProxyViewController.java Thu Mar  1 00:01:02 2007
@@ -22,7 +22,6 @@
 
 import org.apache.directory.ldapstudio.proxy.controller.actions.ConnectAction;
 import org.apache.directory.ldapstudio.proxy.controller.actions.DisconnectAction;
-import org.apache.directory.ldapstudio.proxy.model.LdapProxy;
 import org.apache.directory.ldapstudio.proxy.view.ProxyView;
 import org.eclipse.jface.action.IToolBarManager;
 
@@ -38,9 +37,6 @@
     /** The associated view */
     private ProxyView view;
 
-    /** The LDAP Proxy */
-    private LdapProxy ldapProxy;
-
     // Actions
     private ConnectAction connect;
     private DisconnectAction disconnect;
@@ -83,36 +79,11 @@
 
 
     /**
-     * Gets the LDAP Proxy.
-     *
-     * @return
-     *      the LDAP Proxy
-     */
-    public LdapProxy getLdapProxy()
-    {
-        return ldapProxy;
-    }
-
-
-    /**
-     * Sets the LDAP Proxy.
-     *
-     * @param ldapProxy
-     *      the LDAP Proxy to set
-     */
-    public void setLdapProxy( LdapProxy ldapProxy )
-    {
-        this.ldapProxy = ldapProxy;
-        updateActions();
-    }
-
-
-    /**
      * Enables/Disables Actions.
      */
     private void updateActions()
     {
-        if ( ldapProxy == null )
+        if ( view.getLdapProxy() == null )
         {
             connect.setEnabled( true );
             disconnect.setEnabled( false );

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ConnectAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ConnectAction.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ConnectAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/ConnectAction.java Thu Mar  1 00:01:02 2007
@@ -76,7 +76,7 @@
         {
             LdapProxy ldapProxy = new LdapProxy( connectWizard.getLocalPort(), connectWizard.getRemoteHost(),
                 connectWizard.getRemotePort() );
-            view.getController().setLdapProxy( ldapProxy );
+            view.setLdapProxy( ldapProxy );
             try
             {
                 ldapProxy.connect();

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/DisconnectAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/DisconnectAction.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/DisconnectAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/controller/actions/DisconnectAction.java Thu Mar  1 00:01:02 2007
@@ -60,7 +60,7 @@
      */
     public void run()
     {
-        view.getController().getLdapProxy().disconnect();
-        view.getController().setLdapProxy( null );
+        view.getLdapProxy().disconnect();
+        view.setLdapProxy( null );
     }
 }

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapMessageWithPDU.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapMessageWithPDU.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapMessageWithPDU.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapMessageWithPDU.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,68 @@
+/*
+ *   Copyright 2005 The Apache Software Foundation
+ *
+ *   Licensed 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.ldapstudio.proxy.model;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+
+
+/**
+ * A LdapMessage container
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapMessageWithPDU
+{
+    /** The PDU */
+    private String      dumpBytes;
+
+    /** The ldapMessage */
+    private LdapMessage ldapMessage;
+
+    /** The ldap MessaheId */
+    private int         messageId;
+
+    public String getDumpBytes()
+    {
+        return dumpBytes;
+    }
+
+    public void setDumpBytes( String dumpBytes )
+    {
+        this.dumpBytes = dumpBytes;
+    }
+
+    public LdapMessage getLdapMessage()
+    {
+        return ldapMessage;
+    }
+
+    public void setLdapMessage( LdapMessage ldapMessage )
+    {
+        this.ldapMessage = ldapMessage;
+    }
+
+    public int getMessageId()
+    {
+        return messageId;
+    }
+
+    public void setMessageId( int messageId )
+    {
+        this.messageId = messageId;
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxy.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxy.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxy.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxy.java Thu Mar  1 00:01:02 2007
@@ -22,6 +22,7 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 
@@ -39,6 +40,9 @@
     /** The listeners list */
     private List<LdapProxyListener> listeners;
 
+    /** The received LDAP Messages */
+    private List<LdapMessageWithPDU> receivedLdapMessages;
+
     private LdapProxyThread proxyThread;
 
 
@@ -55,8 +59,8 @@
     public LdapProxy( int localPort, String remoteHost, int remotePort )
     {
         listeners = new ArrayList<LdapProxyListener>();
-
-        proxyThread = new LdapProxyThread( localPort, remoteHost, remotePort, DEFAULT_TIMEOUT );
+        receivedLdapMessages = new ArrayList<LdapMessageWithPDU>();
+        proxyThread = new LdapProxyThread( this, localPort, remoteHost, remotePort, DEFAULT_TIMEOUT );
     }
 
 
@@ -101,5 +105,35 @@
     public void removeListener( LdapProxyListener listener )
     {
         listeners.remove( listener );
+    }
+
+
+    public boolean addReceivedLdapMessage( LdapMessageWithPDU ldapMessage )
+    {
+        boolean bool = receivedLdapMessages.add( ldapMessage );
+        notifyListeners( ldapMessage );
+        return bool;
+    }
+
+
+    /**
+     * Notifies all listeners that a new LDAP Message has arrived.
+     *
+     * @param ldapMessage
+     *      the LDAP Message
+     */
+    private void notifyListeners( LdapMessageWithPDU ldapMessage )
+    {
+        for ( Iterator iter = listeners.iterator(); iter.hasNext(); )
+        {
+            LdapProxyListener proxyListener = ( LdapProxyListener ) iter.next();
+            proxyListener.ldapMessageReceived( ldapMessage );
+        }
+    }
+
+
+    public List<LdapMessageWithPDU> getReceivedLdapMessages()
+    {
+        return receivedLdapMessages;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyListener.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyListener.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyListener.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyListener.java Thu Mar  1 00:01:02 2007
@@ -28,4 +28,11 @@
  */
 public interface LdapProxyListener
 {
+    /**
+     * This method is fired when a new LDAP Message is received by the proxy.
+     *
+     * @param ldapMessage
+     *      the received LDAP Message
+     */
+    public void ldapMessageReceived( LdapMessageWithPDU ldapMessage);
 }

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyThread.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyThread.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyThread.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/model/LdapProxyThread.java Thu Mar  1 00:01:02 2007
@@ -28,6 +28,20 @@
 import java.net.Socket;
 import java.nio.ByteBuffer;
 import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.directory.shared.asn1.ber.Asn1Decoder;
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
+import org.apache.directory.shared.asn1.codec.DecoderException;
+import org.apache.directory.shared.asn1.util.Asn1StringUtils;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapDecoder;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 
 
 /**
@@ -38,6 +52,9 @@
  */
 public class LdapProxyThread extends Thread
 {
+    /** The LDAP proxy */
+    private LdapProxy ldapProxy;
+    
     /** The proxy port */
     private int localPort;
 
@@ -66,8 +83,9 @@
      * @param timeout
      * @param cSocket
      */
-    public LdapProxyThread( int localPort, String remoteHost, int remotePort, long timeout )
+    public LdapProxyThread( LdapProxy ldapProxy, int localPort, String remoteHost, int remotePort, long timeout )
     {
+        this.ldapProxy = ldapProxy;
         this.localPort = localPort;
         this.remoteHost = remoteHost;
         this.remotePort = remotePort;
@@ -150,10 +168,10 @@
                             bb.put( in );
                             bb.flip();
 
-                            //                    while ( bb.hasRemaining() )
-                            //                    {
-                            //                        decode( bb );
-                            //                    }
+                            while ( bb.hasRemaining() )
+                            {
+                                decode( bb );
+                            }
 
                             /*
                              * LdapProxy.setTextIn("--->>>\n", "regular");
@@ -280,6 +298,145 @@
             // TODO Auto-generated catch block
             e1.printStackTrace();
         }
+    }
+    
+    private String decode( ByteBuffer buffer ) throws DecoderException, NamingException
+    {
+        int position = buffer.position();
+
+        DefaultMutableTreeNode mess;
+
+        // DefaultMutableTreeNode messTrue;
+        DefaultMutableTreeNode messTrue;
+
+        Asn1Decoder ldapDecoder = new LdapDecoder();
+
+        // Allocate a LdapMessageContainer Container
+        IAsn1Container ldapMessageContainer = new LdapMessageContainer();
+
+        // Decode the PDU
+        ldapDecoder.decode( buffer, ldapMessageContainer );
+        // Check that everything is OK
+        LdapMessage ldapmessage = ( (LdapMessageContainer) ldapMessageContainer ).getLdapMessage();
+        LdapMessageWithPDU message = new LdapMessageWithPDU();
+        
+
+        message.setLdapMessage( ldapmessage );
+        message.setMessageId( ldapmessage.getMessageId() );
+
+        // check the Id to verfy if it's a new Entry or not
+        if ( message.getMessageId() != lastMessageId )
+        {
+//            mess = new DefaultMutableTreeNode( transformToStringType( ldapmessage.getMessageType() ) + " [Id = "
+//                    + ( (LdapMessage) ldapmessage ).getMessageId() + " ]" );
+//
+//            messTrue = new DefaultMutableTreeNode( message );
+//            lastNode = mess;
+//            lastMessNode = messTrue;
+//            lastMessageId = message.getMessageId();
+//            // mainFrame.getTop().add(mess);
+//            mainFrame.getTreeModel().insertNodeInto( mess, mainFrame.getTop(), mainFrame.getTop().getChildCount() );
+//            mainFrame.getLdapMessageTree().add( messTrue );
+//            currentCount = 1;
+
+        }
+        else
+        {
+//            mess = lastNode;
+//            messTrue = lastMessNode;
+//            currentCount++;
+        }
 
+          String type = transformToStringType( ldapmessage.getMessageType() );
+
+        int pduLength = buffer.position() - position;
+        byte[] bytes = buffer.array();
+        byte[] newBytes = new byte[pduLength];
+        System.arraycopy(bytes, position, newBytes, 0, pduLength );
+
+        //TODO only one methode to Dump including buffer and position.
+        message.setDumpBytes( Asn1StringUtils.dumpBytes( newBytes ) );
+
+        ldapProxy.addReceivedLdapMessage( message );
+        
+        return message.getLdapMessage().toString();
+    }
+    
+    public String transformToStringType( int type )
+    {
+        String stringType;
+
+        switch ( type )
+        {
+            case LdapConstants.ABANDON_REQUEST :
+                stringType = "ABANDON REQUEST";
+                break;
+            case LdapConstants.ADD_REQUEST :
+                stringType = "ADD REQUEST";
+                break;
+            case LdapConstants.ADD_RESPONSE :
+                stringType = "ADD RESPONSE";
+                break;
+            case LdapConstants.BIND_REQUEST :
+                stringType = "BIND REQUEST";
+                break;
+            case LdapConstants.BIND_RESPONSE :
+                stringType = "BIND RESPONSE";
+                break;
+            case LdapConstants.COMPARE_REQUEST :
+                stringType = "COMPARE REQUEST";
+                break;
+            case LdapConstants.COMPARE_RESPONSE :
+                stringType = "COMPARE RESPONSE";
+                break;
+            case LdapConstants.DEL_REQUEST :
+                stringType = "DEL REQUEST";
+                break;
+            case LdapConstants.DEL_RESPONSE :
+                stringType = "DEL RESPONSE";
+                break;
+            case LdapConstants.EXTENDED_REQUEST :
+                stringType = "EXTENDED REQUEST";
+                break;
+            case LdapConstants.EXTENDED_RESPONSE :
+                stringType = "EXTENDED RESPONSE";
+                break;
+            case LdapConstants.MODIFYDN_REQUEST :
+                stringType = "MODIFYDN REQUEST";
+                break;
+            case LdapConstants.MODIFYDN_RESPONSE :
+                stringType = "MODIFYDN RESPONSE";
+                break;
+            case LdapConstants.MODIFY_REQUEST :
+                stringType = "MODIFY REQUEST";
+                break;
+            case LdapConstants.MODIFY_RESPONSE :
+                stringType = "MODIFY RESPONSE";
+                break;
+            case LdapConstants.SEARCH_REQUEST :
+                stringType = "SEARCH REQUEST";
+                break;
+            case LdapConstants.SEARCH_RESULT_DONE :
+                stringType = "SEARCH RESULT DONE";
+                break;
+            case LdapConstants.SEARCH_RESULT_ENTRY :
+                stringType = "SEARCH RESULT ENTRY";
+                break;
+            case LdapConstants.SEARCH_RESULT_REFERENCE :
+                stringType = "SEARCH RESULT REFERENCE";
+                break;
+            case LdapConstants.UNBIND_REQUEST :
+                stringType = "UNBIND REQUEST";
+                break;
+            case LdapConstants.UNKNOWN:
+                stringType = "UNKNOWN";
+                break;
+
+            default :
+                stringType = "UNKNOWN";
+                break;
+        }
+        
+        return stringType;
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyView.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyView.java?view=diff&rev=513220&r1=513219&r2=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyView.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyView.java Thu Mar  1 00:01:02 2007
@@ -20,14 +20,21 @@
 package org.apache.directory.ldapstudio.proxy.view;
 
 
+import org.apache.directory.ldapstudio.browser.core.model.filter.LdapOrFilterComponent;
 import org.apache.directory.ldapstudio.proxy.Activator;
 import org.apache.directory.ldapstudio.proxy.controller.ProxyViewController;
+import org.apache.directory.ldapstudio.proxy.model.LdapMessageWithPDU;
+import org.apache.directory.ldapstudio.proxy.model.LdapProxy;
+import org.apache.directory.ldapstudio.proxy.model.LdapProxyListener;
+import org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper;
+import org.apache.directory.ldapstudio.proxy.view.wrappers.LdapMessageWrapper;
+import org.apache.directory.ldapstudio.proxy.view.wrappers.LdapProxyWrapper;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
 
 
 /**
@@ -45,7 +52,30 @@
     private ProxyViewController controller;
 
     /** The tree viewer */
-    private Tree viewer;
+    private TreeViewer viewer;
+
+    /** The LDAP Proxy */
+    private LdapProxy ldapProxy;
+
+    /** The LDAP Proxy Wrapper */
+    private LdapProxyWrapper ldapProxyWrapper;
+
+    /** The Proxy Listener */
+    private LdapProxyListener proxyListener = new LdapProxyListener()
+    {
+        public void ldapMessageReceived( final LdapMessageWithPDU ldapMessage )
+        {
+            System.out.println( ldapMessage.getLdapMessage() );
+            PlatformUI.getWorkbench().getDisplay().asyncExec( new Runnable()
+            {
+                public void run()
+                {
+//                    viewer.refresh();
+                    ( ( LdapProxyWrapper ) viewer.getInput() ).addChild( new LdapMessageWrapper( ( IWrapper ) viewer.getInput(), ldapMessage ) );
+                }
+            } );
+        }
+    };
 
 
     /* (non-Javadoc)
@@ -53,50 +83,55 @@
      */
     public void createPartControl( Composite parent )
     {
-        viewer = new Tree( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        viewer = new TreeViewer( parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
+        viewer.setContentProvider( new ProxyViewContentProvider() );
+        viewer.setLabelProvider( new ProxyViewLabelProvider() );
+        ldapProxyWrapper = new LdapProxyWrapper( this );
+        viewer.setInput( ldapProxyWrapper );
+
         controller = new ProxyViewController( this );
 
-        // TODO Remove
-        TreeItem treeItem = new TreeItem( viewer, SWT.NONE );
-        treeItem.setText( "Bind [id=1]" );
-
-        treeItem = new TreeItem( treeItem, SWT.NONE );
-        treeItem.setText( "Bind Request" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.IN )
-            .createImage() );
-
-        treeItem = new TreeItem( viewer.getTopItem(), SWT.NONE );
-        treeItem.setText( "Bind Response" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
-            .createImage() );
-
-        TreeItem treeItem2 = new TreeItem( viewer, SWT.NONE );
-        treeItem2.setText( "Search [id=2]" );
-
-        treeItem = new TreeItem( treeItem2, SWT.NONE );
-        treeItem.setText( "Search Request" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.IN )
-            .createImage() );
-
-        treeItem = new TreeItem( treeItem2, SWT.NONE );
-        treeItem.setText( "Search Result Entry" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
-            .createImage() );
-
-        treeItem = new TreeItem( treeItem2, SWT.NONE );
-        treeItem.setText( "Search Result Entry" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
-            .createImage() );
-
-        treeItem = new TreeItem( treeItem2, SWT.NONE );
-        treeItem.setText( "Search Result Entry" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
-            .createImage() );
-
-        treeItem = new TreeItem( treeItem2, SWT.NONE );
-        treeItem.setText( "Search Result Done" );
-        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
-            .createImage() );
+        //        // TODO Remove
+        //        TreeItem treeItem = new TreeItem( viewer, SWT.NONE );
+        //        treeItem.setText( "Bind [id=1]" );
+        //
+        //        treeItem = new TreeItem( treeItem, SWT.NONE );
+        //        treeItem.setText( "Bind Request" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.IN )
+        //            .createImage() );
+        //
+        //        treeItem = new TreeItem( viewer.getTopItem(), SWT.NONE );
+        //        treeItem.setText( "Bind Response" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
+        //            .createImage() );
+        //
+        //        TreeItem treeItem2 = new TreeItem( viewer, SWT.NONE );
+        //        treeItem2.setText( "Search [id=2]" );
+        //
+        //        treeItem = new TreeItem( treeItem2, SWT.NONE );
+        //        treeItem.setText( "Search Request" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.IN )
+        //            .createImage() );
+        //
+        //        treeItem = new TreeItem( treeItem2, SWT.NONE );
+        //        treeItem.setText( "Search Result Entry" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
+        //            .createImage() );
+        //
+        //        treeItem = new TreeItem( treeItem2, SWT.NONE );
+        //        treeItem.setText( "Search Result Entry" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
+        //            .createImage() );
+        //
+        //        treeItem = new TreeItem( treeItem2, SWT.NONE );
+        //        treeItem.setText( "Search Result Entry" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
+        //            .createImage() );
+        //
+        //        treeItem = new TreeItem( treeItem2, SWT.NONE );
+        //        treeItem.setText( "Search Result Done" );
+        //        treeItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT )
+        //            .createImage() );
     }
 
 
@@ -105,12 +140,38 @@
      */
     public void setFocus()
     {
-        viewer.setFocus();
+        viewer.getControl().setFocus();
     }
 
 
     public ProxyViewController getController()
     {
         return controller;
+    }
+
+
+    public TreeViewer getViewer()
+    {
+        return viewer;
+    }
+
+
+    public LdapProxy getLdapProxy()
+    {
+        return ldapProxy;
+    }
+
+
+    public void setLdapProxy( LdapProxy ldapProxy )
+    {
+        if ( this.ldapProxy != null )
+        {
+            this.ldapProxy.removeListener( proxyListener );
+        }
+        this.ldapProxy = ldapProxy;
+        if ( ldapProxy != null )
+        {
+            ldapProxy.addListener( proxyListener );
+        }
     }
 }

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewContentProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewContentProvider.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewContentProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewContentProvider.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,103 @@
+/*
+ *  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.ldapstudio.proxy.view;
+
+
+import org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * This class implements the Label Provider for the Proxy View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProxyViewContentProvider implements IStructuredContentProvider, ITreeContentProvider
+{
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    public Object[] getChildren( Object parentElement )
+    {
+        if ( parentElement instanceof IWrapper )
+        {
+            return ( ( IWrapper ) parentElement ).getChildren().toArray();
+        }
+
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent( Object element )
+    {
+        if ( element instanceof IWrapper )
+        {
+            return ( ( IWrapper ) element ).getParent();
+        }
+
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren( Object element )
+    {
+        if ( element instanceof IWrapper )
+        {
+            return ( ( IWrapper ) element ).hasChildren();
+        }
+
+        return true;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewLabelProvider.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewLabelProvider.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/ProxyViewLabelProvider.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.proxy.view;
+
+import org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper;
+import org.eclipse.jface.viewers.LabelProvider;
+
+/**
+ * This class implements the Content Provider for the Proxy View.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ProxyViewLabelProvider extends LabelProvider
+{
+    
+    public String getText( Object element )
+    {
+        if ( element instanceof IWrapper )
+        {
+            return ( ( IWrapper ) element ).getText();
+        }
+        
+        return super.getText( element );
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/AbstractWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/AbstractWrapper.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/AbstractWrapper.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/AbstractWrapper.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,116 @@
+/*
+ *  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.ldapstudio.proxy.view.wrappers;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This abstract class implements the IWrapper interface and represents a Wrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractWrapper implements IWrapper
+{
+    /** The parent element */
+    protected IWrapper fParent;
+
+    /** The children */
+    protected List<IWrapper> fChildren;
+
+
+    /**
+     * Creates a new instance of Wrapper.
+     *
+     * @param parent
+     *      the parent element
+     */
+    public AbstractWrapper( IWrapper parent )
+    {
+        fParent = parent;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getText()
+     */
+    public String getText()
+    {
+        return toString();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getImage()
+     */
+    public Image getImage()
+    {
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getChildren()
+     */
+    public List<IWrapper> getChildren()
+    {
+        if ( fChildren != null )
+        {
+            return fChildren;
+        }
+
+        fChildren = new ArrayList<IWrapper>();
+        createChildren( fChildren );
+
+        return fChildren;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#getParent()
+     */
+    public IWrapper getParent()
+    {
+        return fParent;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.IWrapper#hasChildren()
+     */
+    public boolean hasChildren()
+    {
+        return true;
+    }
+
+
+    /**
+     * Creates the children of the elements and adds them to the given children List
+     *
+     * @param children
+     *      the children List to add children to
+     */
+    protected abstract void createChildren( List<IWrapper> children );
+}

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/IWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/IWrapper.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/IWrapper.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/IWrapper.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,80 @@
+/*
+ *  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.ldapstudio.proxy.view.wrappers;
+
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * This interface defines an element that can be displayed in the LDAP Proxy TreeViewer.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IWrapper
+{
+    /**
+     * Returns the text for the label of the element.
+     *
+     * @return
+     *      the text string used to label the element, or null  if there is no text label for the element
+     */
+    public String getText();
+
+
+    /**
+     * Returns the image for the label of the element. 
+     *
+     * @return
+     *      the image used to label the element, or null  if there is no image for the element
+     */
+    public Image getImage();
+
+
+    /**
+     * Returns the child elements of the element.
+     *
+     * @return
+     *      a List of child elements
+     */
+    public List<IWrapper> getChildren();
+
+
+    /**
+     * Returns whether the element has children.
+     *
+     * @return
+     *      true if the given element has children, and false if it has no children
+     */
+    public boolean hasChildren();
+
+
+    /**
+     * Returns the parent for the element, or null indicating that the parent can't be computed. 
+     * In this case the tree-structured viewer can't expand a given node correctly if requested.
+     *
+     * @return
+     *      the parent element, or null if it has none or if the parent cannot be computed
+     */
+    public IWrapper getParent();
+}

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapMessageWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapMessageWrapper.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapMessageWrapper.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapMessageWrapper.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,83 @@
+/*
+ *  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.ldapstudio.proxy.view.wrappers;
+
+
+import java.util.List;
+
+import org.apache.directory.ldapstudio.proxy.Activator;
+import org.apache.directory.ldapstudio.proxy.model.LdapMessageWithPDU;
+import org.apache.directory.ldapstudio.proxy.view.IImageKeys;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents a LDAP Message Wrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdapMessageWrapper extends AbstractWrapper
+{
+    private LdapMessageWithPDU ldapMessage;
+
+
+    /**
+     * Creates a new instance of LdapMessageWrapper.
+     *
+     * @param parent
+     *      the parent element
+     */
+    public LdapMessageWrapper( IWrapper parent, LdapMessageWithPDU ldapMessage )
+    {
+        super( parent );
+        this.ldapMessage = ldapMessage;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.Wrapper#createChildren(java.util.List)
+     */
+    protected void createChildren( List<IWrapper> children )
+    {
+        // TODO Auto-generated method stub
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.Wrapper#getImage()
+     */
+    public Image getImage()
+    {
+        // TODO Auto-generated method stub
+        return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, IImageKeys.OUT ).createImage();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.Wrapper#getText()
+     */
+    public String getText()
+    {
+        return ldapMessage.getLdapMessage().getMessageTypeName() + " - " + ldapMessage.getMessageId();
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapProxyWrapper.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapProxyWrapper.java?view=auto&rev=513220
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapProxyWrapper.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-proxy/src/main/java/org/apache/directory/ldapstudio/proxy/view/wrappers/LdapProxyWrapper.java Thu Mar  1 00:01:02 2007
@@ -0,0 +1,78 @@
+/*
+ *  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.ldapstudio.proxy.view.wrappers;
+
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.proxy.model.LdapMessageWithPDU;
+import org.apache.directory.ldapstudio.proxy.model.LdapProxy;
+import org.apache.directory.ldapstudio.proxy.view.ProxyView;
+
+
+/**
+ * This class represents a LDAP Proxy Wrapper.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdapProxyWrapper extends AbstractWrapper
+{
+    /** The associated view */
+    private ProxyView view;
+
+
+    /**
+     * Creates a new instance of LdapProxyWrapper.
+     *
+     * @param parent
+     *      the parent element
+     */
+    public LdapProxyWrapper( ProxyView view )
+    {
+        super( null );
+        this.view = view;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.proxy.view.wrappers.Wrapper#createChildren(java.util.List)
+     */
+    protected void createChildren( List<IWrapper> children )
+    {
+        LdapProxy ldapProxy = view.getLdapProxy();
+
+        if ( ldapProxy != null )
+        {
+            List<LdapMessageWithPDU> receivedLdapMessages = ldapProxy.getReceivedLdapMessages();
+            for ( Iterator iter = receivedLdapMessages.iterator(); iter.hasNext(); )
+            {
+                children.add( new LdapMessageWrapper( this, ( ( LdapMessageWithPDU ) iter.next() ) ) );
+            }
+        }
+        System.out.println( "createChildren" );
+    }
+    
+    public void addChild( IWrapper element )
+    {
+        fChildren.add( element );
+    }
+}



Mime
View raw message