You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/05 23:53:12 UTC
svn commit: r278864 - in /directory/sandbox/trunk/proxy: ./ images/ src/
src/java/ src/java/main/ src/java/main/org/ src/java/main/org/apache/
src/java/main/org/apache/ldap/ src/java/main/org/apache/ldap/proxy/
src/java/main/org/apache/ldap/proxy/gui/ ...
Author: elecharny
Date: Mon Sep 5 14:52:56 2005
New Revision: 278864
URL: http://svn.apache.org/viewcvs?rev=278864&view=rev
Log:
Added the new version of the LdapProxy, written by Jocelyn Dodin
Added:
directory/sandbox/trunk/proxy/
directory/sandbox/trunk/proxy/LICENSE.txt
directory/sandbox/trunk/proxy/NOTICE.txt
directory/sandbox/trunk/proxy/images/
directory/sandbox/trunk/proxy/images/gnome-icone-001.gif (with props)
directory/sandbox/trunk/proxy/images/gnome-icone-002.gif (with props)
directory/sandbox/trunk/proxy/images/gnome-icone-003.gif (with props)
directory/sandbox/trunk/proxy/images/gnome-icone-007.gif (with props)
directory/sandbox/trunk/proxy/images/razor-art-icone-001.gif (with props)
directory/sandbox/trunk/proxy/images/razor-art-icone-011.gif (with props)
directory/sandbox/trunk/proxy/images/sputnik-icone-001.gif (with props)
directory/sandbox/trunk/proxy/images/sputnik-icone-002.gif (with props)
directory/sandbox/trunk/proxy/maven.xml
directory/sandbox/trunk/proxy/project.properties
directory/sandbox/trunk/proxy/project.xml
directory/sandbox/trunk/proxy/src/
directory/sandbox/trunk/proxy/src/java/
directory/sandbox/trunk/proxy/src/java/main/
directory/sandbox/trunk/proxy/src/java/main/org/
directory/sandbox/trunk/proxy/src/java/main/org/apache/
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/MainFrame.java
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapMessageWithPDU.java
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapProxy.java
directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/ProxyConnection.java
Added: directory/sandbox/trunk/proxy/LICENSE.txt
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/LICENSE.txt?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/LICENSE.txt (added)
+++ directory/sandbox/trunk/proxy/LICENSE.txt Mon Sep 5 14:52:56 2005
@@ -0,0 +1,204 @@
+/*
+ * Apache License
+ * Version 2.0, January 2004
+ * http://www.apache.org/licenses/
+ *
+ * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+ *
+ * 1. Definitions.
+ *
+ * "License" shall mean the terms and conditions for use, reproduction,
+ * and distribution as defined by Sections 1 through 9 of this document.
+ *
+ * "Licensor" shall mean the copyright owner or entity authorized by
+ * the copyright owner that is granting the License.
+ *
+ * "Legal Entity" shall mean the union of the acting entity and all
+ * other entities that control, are controlled by, or are under common
+ * control with that entity. For the purposes of this definition,
+ * "control" means (i) the power, direct or indirect, to cause the
+ * direction or management of such entity, whether by contract or
+ * otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ * outstanding shares, or (iii) beneficial ownership of such entity.
+ *
+ * "You" (or "Your") shall mean an individual or Legal Entity
+ * exercising permissions granted by this License.
+ *
+ * "Source" form shall mean the preferred form for making modifications,
+ * including but not limited to software source code, documentation
+ * source, and configuration files.
+ *
+ * "Object" form shall mean any form resulting from mechanical
+ * transformation or translation of a Source form, including but
+ * not limited to compiled object code, generated documentation,
+ * and conversions to other media types.
+ *
+ * "Work" shall mean the work of authorship, whether in Source or
+ * Object form, made available under the License, as indicated by a
+ * copyright notice that is included in or attached to the work
+ * (an example is provided in the Appendix below).
+ *
+ * "Derivative Works" shall mean any work, whether in Source or Object
+ * form, that is based on (or derived from) the Work and for which the
+ * editorial revisions, annotations, elaborations, or other modifications
+ * represent, as a whole, an original work of authorship. For the purposes
+ * of this License, Derivative Works shall not include works that remain
+ * separable from, or merely link (or bind by name) to the interfaces of,
+ * the Work and Derivative Works thereof.
+ *
+ * "Contribution" shall mean any work of authorship, including
+ * the original version of the Work and any modifications or additions
+ * to that Work or Derivative Works thereof, that is intentionally
+ * submitted to Licensor for inclusion in the Work by the copyright owner
+ * or by an individual or Legal Entity authorized to submit on behalf of
+ * the copyright owner. For the purposes of this definition, "submitted"
+ * means any form of electronic, verbal, or written communication sent
+ * to the Licensor or its representatives, including but not limited to
+ * communication on electronic mailing lists, source code control systems,
+ * and issue tracking systems that are managed by, or on behalf of, the
+ * Licensor for the purpose of discussing and improving the Work, but
+ * excluding communication that is conspicuously marked or otherwise
+ * designated in writing by the copyright owner as "Not a Contribution."
+ *
+ * "Contributor" shall mean Licensor and any individual or Legal Entity
+ * on behalf of whom a Contribution has been received by Licensor and
+ * subsequently incorporated within the Work.
+ *
+ * 2. Grant of Copyright License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * copyright license to reproduce, prepare Derivative Works of,
+ * publicly display, publicly perform, sublicense, and distribute the
+ * Work and such Derivative Works in Source or Object form.
+ *
+ * 3. Grant of Patent License. Subject to the terms and conditions of
+ * this License, each Contributor hereby grants to You a perpetual,
+ * worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ * (except as stated in this section) patent license to make, have made,
+ * use, offer to sell, sell, import, and otherwise transfer the Work,
+ * where such license applies only to those patent claims licensable
+ * by such Contributor that are necessarily infringed by their
+ * Contribution(s) alone or by combination of their Contribution(s)
+ * with the Work to which such Contribution(s) was submitted. If You
+ * institute patent litigation against any entity (including a
+ * cross-claim or counterclaim in a lawsuit) alleging that the Work
+ * or a Contribution incorporated within the Work constitutes direct
+ * or contributory patent infringement, then any patent licenses
+ * granted to You under this License for that Work shall terminate
+ * as of the date such litigation is filed.
+ *
+ * 4. Redistribution. You may reproduce and distribute copies of the
+ * Work or Derivative Works thereof in any medium, with or without
+ * modifications, and in Source or Object form, provided that You
+ * meet the following conditions:
+ *
+ * (a) You must give any other recipients of the Work or
+ * Derivative Works a copy of this License; and
+ *
+ * (b) You must cause any modified files to carry prominent notices
+ * stating that You changed the files; and
+ *
+ * (c) You must retain, in the Source form of any Derivative Works
+ * that You distribute, all copyright, patent, trademark, and
+ * attribution notices from the Source form of the Work,
+ * excluding those notices that do not pertain to any part of
+ * the Derivative Works; and
+ *
+ * (d) If the Work includes a "NOTICE" text file as part of its
+ * distribution, then any Derivative Works that You distribute must
+ * include a readable copy of the attribution notices contained
+ * within such NOTICE file, excluding those notices that do not
+ * pertain to any part of the Derivative Works, in at least one
+ * of the following places: within a NOTICE text file distributed
+ * as part of the Derivative Works; within the Source form or
+ * documentation, if provided along with the Derivative Works; or,
+ * within a display generated by the Derivative Works, if and
+ * wherever such third-party notices normally appear. The contents
+ * of the NOTICE file are for informational purposes only and
+ * do not modify the License. You may add Your own attribution
+ * notices within Derivative Works that You distribute, alongside
+ * or as an addendum to the NOTICE text from the Work, provided
+ * that such additional attribution notices cannot be construed
+ * as modifying the License.
+ *
+ * You may add Your own copyright statement to Your modifications and
+ * may provide additional or different license terms and conditions
+ * for use, reproduction, or distribution of Your modifications, or
+ * for any such Derivative Works as a whole, provided Your use,
+ * reproduction, and distribution of the Work otherwise complies with
+ * the conditions stated in this License.
+ *
+ * 5. Submission of Contributions. Unless You explicitly state otherwise,
+ * any Contribution intentionally submitted for inclusion in the Work
+ * by You to the Licensor shall be under the terms and conditions of
+ * this License, without any additional terms or conditions.
+ * Notwithstanding the above, nothing herein shall supersede or modify
+ * the terms of any separate license agreement you may have executed
+ * with Licensor regarding such Contributions.
+ *
+ * 6. Trademarks. This License does not grant permission to use the trade
+ * names, trademarks, service marks, or product names of the Licensor,
+ * except as required for reasonable and customary use in describing the
+ * origin of the Work and reproducing the content of the NOTICE file.
+ *
+ * 7. Disclaimer of Warranty. Unless required by applicable law or
+ * agreed to in writing, Licensor provides the Work (and each
+ * Contributor provides its Contributions) on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied, including, without limitation, any warranties or conditions
+ * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ * PARTICULAR PURPOSE. You are solely responsible for determining the
+ * appropriateness of using or redistributing the Work and assume any
+ * risks associated with Your exercise of permissions under this License.
+ *
+ * 8. Limitation of Liability. In no event and under no legal theory,
+ * whether in tort (including negligence), contract, or otherwise,
+ * unless required by applicable law (such as deliberate and grossly
+ * negligent acts) or agreed to in writing, shall any Contributor be
+ * liable to You for damages, including any direct, indirect, special,
+ * incidental, or consequential damages of any character arising as a
+ * result of this License or out of the use or inability to use the
+ * Work (including but not limited to damages for loss of goodwill,
+ * work stoppage, computer failure or malfunction, or any and all
+ * other commercial damages or losses), even if such Contributor
+ * has been advised of the possibility of such damages.
+ *
+ * 9. Accepting Warranty or Additional Liability. While redistributing
+ * the Work or Derivative Works thereof, You may choose to offer,
+ * and charge a fee for, acceptance of support, warranty, indemnity,
+ * or other liability obligations and/or rights consistent with this
+ * License. However, in accepting such obligations, You may act only
+ * on Your own behalf and on Your sole responsibility, not on behalf
+ * of any other Contributor, and only if You agree to indemnify,
+ * defend, and hold each Contributor harmless for any liability
+ * incurred by, or claims asserted against, such Contributor by reason
+ * of your accepting any such warranty or additional liability.
+ *
+ * END OF TERMS AND CONDITIONS
+ *
+ * APPENDIX: How to apply the Apache License to your work.
+ *
+ * To apply the Apache License to your work, attach the following
+ * boilerplate notice, with the fields enclosed by brackets "[]"
+ * replaced with your own identifying information. (Don't include
+ * the brackets!) The text should be enclosed in the appropriate
+ * comment syntax for the file format. We also recommend that a
+ * file or class name and description of purpose be included on the
+ * same "printed page" as the copyright notice for easier
+ * identification within third-party archives.
+ *
+ * Copyright [yyyy] [name of copyright owner]
+ *
+ * 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.
+ *
+ */
Added: directory/sandbox/trunk/proxy/NOTICE.txt
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/NOTICE.txt?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/NOTICE.txt (added)
+++ directory/sandbox/trunk/proxy/NOTICE.txt Mon Sep 5 14:52:56 2005
@@ -0,0 +1,4 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+
Added: directory/sandbox/trunk/proxy/images/gnome-icone-001.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/gnome-icone-001.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/gnome-icone-001.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/gnome-icone-002.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/gnome-icone-002.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/gnome-icone-002.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/gnome-icone-003.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/gnome-icone-003.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/gnome-icone-003.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/gnome-icone-007.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/gnome-icone-007.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/gnome-icone-007.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/razor-art-icone-001.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/razor-art-icone-001.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/razor-art-icone-001.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/razor-art-icone-011.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/razor-art-icone-011.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/razor-art-icone-011.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/sputnik-icone-001.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/sputnik-icone-001.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/sputnik-icone-001.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/images/sputnik-icone-002.gif
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/images/sputnik-icone-002.gif?rev=278864&view=auto
==============================================================================
Binary file - no diff available.
Propchange: directory/sandbox/trunk/proxy/images/sputnik-icone-002.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/sandbox/trunk/proxy/maven.xml
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/maven.xml?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/maven.xml (added)
+++ directory/sandbox/trunk/proxy/maven.xml Mon Sep 5 14:52:56 2005
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project
+ default="jar:install"
+ >
+
+</project>
\ No newline at end of file
Added: directory/sandbox/trunk/proxy/project.properties
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/project.properties?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/project.properties (added)
+++ directory/sandbox/trunk/proxy/project.properties Mon Sep 5 14:52:56 2005
@@ -0,0 +1,19 @@
+maven.repo.remote=http://cvs.apache.org/repository, http://ibiblio.org/maven, http://ldapd.sourceforge.net/maven/repository
+maven.compile.source = 1.4
+maven.compile.target = 1.4
+
+maven.javadoc.private=true
+maven.javadoc.customtags=tag1 tag2
+maven.junit.fork=true
+
+tag1.name=todo
+tag1.description=To Do:
+tag1.enabled=true
+tag1.scope=all
+
+tag2.name=task
+tag2.description=Task:
+tag2.enabled=false
+tag2.scope=all
+
+maven.license.licenseFile=../../LICENSE.txt
Added: directory/sandbox/trunk/proxy/project.xml
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/project.xml?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/project.xml (added)
+++ directory/sandbox/trunk/proxy/project.xml Mon Sep 5 14:52:56 2005
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <pomVersion>1</pomVersion>
+ <artifactId>null</artifactId>
+ <groupId>directory-asn1</groupId>
+ <id>directory-asn1:null</id>
+ <name>Ldap Proxy</name>
+ <package>org.apache.ldap.proxy</package>
+ <currentVersion>0.2-SNAPSHOT</currentVersion>
+ <organization>
+ <name>The Apache Directory Project</name>
+ <url>http://directory.apache.org</url>
+ <logo>http://directory.apache.org/images/apache-directory-logo.png</logo>
+ </organization>
+ <inceptionYear>2005</inceptionYear>
+ <logo>http://directory.apache.org/images/apache-directory-logo.png</logo>
+ <url>http://directory.apache.org/subprojects/sandbox/proxy</url>
+ <issueTrackingUrl>http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10517</issueTrackingUrl>
+ <siteAddress>minotaur.apache.org</siteAddress>
+ <siteDirectory>/www/directory.apache.org</siteDirectory>
+ <distributionDirectory>/www/cvs.apache.org/dist/directory</distributionDirectory>
+ <gumpRepositoryId>directory</gumpRepositoryId>
+ <repository>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/directory:sandbox/trunk/${module.path}</connection>
+ <url>http://svn.apache.org/viewcvs.cgi/directory/sandbox/trunk/${module.path}/?root=Apache-SVN</url>
+ <developerConnection>https://svn.apache.org/repos/asf/directory/sandbox/trunk/${module.path}</developerConnection>
+ </repository>
+ <shortDescription>Apache Ldap Proxy</shortDescription>
+ <description>This is an experimental implementation of a new LDAP ASN.1 codec</description>
+ <mailingLists>
+ <mailingList>
+ <name>Apache Directory Developement - use [proxy] prefix</name>
+ <subscribe>dev-subscribe@directory.apache.org</subscribe>
+ <unsubscribe>dev-unsubscribe@directory.apache.org</unsubscribe>
+ <archive>http://mail-archives.apache.org/eyebrowse/ViewLists</archive>
+ </mailingList>
+ </mailingLists>
+ <developers>
+ <developer>
+ <name>Jocelyn Dodin</name>
+ <id>0</id>
+ </developer>
+ <developer>
+ <name>Emmanuel Lécharny</name>
+ <id>ele</id>
+ <email>elecharny at apache.org</email>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>Apache 2.0 License</name>
+ <url>http://cvs.apache.org/viewcvs.cgi/directory/LICENSE.txt?rev=1369&root=Apache-SVN&view=markup</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <type>jar</type>
+ <url>http://junit.org</url>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>nlog4j</artifactId>
+ <version>1.2.14</version>
+ <type>jar</type>
+ <url>http://slf4j.org/nlog4j</url>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.3.4-RC8_min</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.1.2</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>directory-asn1</groupId>
+ <artifactId>asn1-new-ber</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>directory-shared</groupId>
+ <artifactId>apache-new-ldapber-provider</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <nagEmailAddress>dev@directory.apache.org</nagEmailAddress>
+ <sourceDirectory>${basedir}/src/java/main</sourceDirectory>
+ <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*Test*</include>
+ <include>**/*TestCase*</include>
+ </includes>
+ <excludes>
+ <exclude>**/testutils/*</exclude>
+ <exclude>**/Abstract*</exclude>
+ </excludes>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/test</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.ldif</include>
+ <include>**/*.properties</include>
+ <include>**/*.x*</include>
+ <include>**/*.mf</include>
+ <include>**/*.jar</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/test</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.ldif</include>
+ <include>**/*.properties</include>
+ <include>**/*.x*</include>
+ <include>**/*.mf</include>
+ <include>**/*.jar</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </unitTest>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/java/main</directory>
+ <includes>
+ <include>**/*.dtd</include>
+ <include>**/*.properties</include>
+ <include>**/*.x*</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ <resource>
+ <directory>${basedir}/../</directory>
+ <targetPath>META-INF</targetPath>
+ <includes>
+ <include>LICENSE.txt</include>
+ <include>NOTICE.txt</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ <jars />
+ </build>
+ <reports>
+ <report>maven-jxr-plugin</report>
+ <report>maven-license-plugin</report>
+ <!-- report>maven-changelog-plugin</report -->
+ <report>maven-javadoc-plugin</report>
+ <report>maven-clover-plugin</report>
+ <report>maven-tasklist-plugin</report>
+ </reports>
+</project>
+
Added: directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/MainFrame.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/MainFrame.java?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/MainFrame.java (added)
+++ directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/gui/MainFrame.java Mon Sep 5 14:52:56 2005
@@ -0,0 +1,578 @@
+/*
+ * 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.ldap.proxy.gui;
+
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.apache.ldap.proxy.impl.LdapMessageWithPDU;
+import org.apache.ldap.proxy.impl.LdapProxy;
+
+import com.thoughtworks.xstream.XStream;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.HeadlessException;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import java.net.UnknownHostException;
+
+import javax.swing.ImageIcon;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextPane;
+import javax.swing.JTree;
+import javax.swing.KeyStroke;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultStyledDocument;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreeSelectionModel;
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author $author$
+ */
+public class MainFrame extends JFrame implements TreeSelectionListener, TreeExpansionListener {
+ // ~ Static fields/initializers
+ // -----------------------------------------------------------------
+
+ /** frame itSelf */
+ private MainFrame itSelf;
+
+ /** Frame and Application name */
+ public static final String FRAME_NAME = "LDAP Proxy GUI";
+
+ /** NOT USED */
+ // public static final long serialVersionUID = 0;
+ /** Frame default Size */
+ public static final Rectangle FRAME_SIZE = new Rectangle(100, 100, 1000, 500);
+
+ // ~ Instance fields
+ // ----------------------------------------------------------------------------
+
+ // ALL Panel
+ /** DOCUMENT ME! */
+ private JSplitPane principalPanel;
+
+ /** DOCUMENT ME! */
+ private JScrollPane jspIn;
+
+ /** DOCUMENT ME! */
+ private JScrollPane jspOut;
+
+ /** DOCUMENT ME! */
+ private JTree messageTree;
+
+ /** DOCUMENT ME! */
+ private JTextPane textOut;
+
+ // List of Menu
+ /** DOCUMENT ME! */
+ private JMenuBar menuBar = new JMenuBar();
+
+ /** DOCUMENT ME! */
+ private JMenu file = new JMenu("File");
+
+ /** DOCUMENT ME! */
+ private JMenu edit = new JMenu("edit");
+
+ /** DOCUMENT ME! */
+ private JMenuItem newMenu = new JMenuItem("New...");
+
+ /** DOCUMENT ME! */
+ private JMenuItem load = new JMenuItem("load");
+
+ /** DOCUMENT ME! */
+ private JMenuItem save = new JMenuItem("Save");
+
+ /** DOCUMENT ME! */
+ private JMenuItem quit = new JMenuItem("Quit");
+
+ /** DOCUMENT ME! */
+ private JCheckBoxMenuItem pduView = new JCheckBoxMenuItem("View PDU");
+
+ /** DOCUMENT ME! */
+ private LdapProxy ldapProxy;
+
+ /** DOCUMENT ME! */
+ private DefaultStyledDocument docOut;
+
+ private String[] args;
+
+ private DefaultMutableTreeNode top;
+
+ private DefaultMutableTreeNode ldapMessageTree;
+
+ private DefaultTreeModel treeModel;
+
+ // STYLE
+ private SimpleAttributeSet boldItalicRedText;
+
+ private SimpleAttributeSet boldText;
+
+ private SimpleAttributeSet boldItalicBlueText;
+
+ private SimpleAttributeSet pduStyle;
+
+ final static String SEPARATOR = "\n====================================\n";
+
+
+ // ~ Constructors
+ // -------------------------------------------------------------------------------
+
+ /**
+ * Creates a new MainFrame object.
+ *
+ * @throws HeadlessException
+ * DOCUMENT ME!
+ * @throws UnknownHostException
+ * DOCUMENT ME!
+ * @throws IOException
+ * DOCUMENT ME!
+ */
+ public MainFrame() throws HeadlessException, UnknownHostException, IOException {
+ super();
+ initFrame();
+
+ }
+
+ // ~ Methods
+ // ------------------------------------------------------------------------------------
+
+ public void initFrame(){
+ setItSelf(this);
+ setTitle(FRAME_NAME);
+ setBounds(FRAME_SIZE);
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setJMenuBar(initMenuBar());
+ top = new DefaultMutableTreeNode("Start");
+ treeModel = new DefaultTreeModel(top);
+ messageTree = new JTree(treeModel);
+ ldapMessageTree = new DefaultMutableTreeNode("Start Ldap message");
+
+ messageTree.addTreeExpansionListener(this);
+ messageTree.addTreeSelectionListener(this);
+
+ messageTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+ initRenderTree();
+ messageTree.setBackground(Color.lightGray);
+ messageTree.putClientProperty("JTree.lineStyle", "None");
+
+ initStyleForEditing();
+
+ messageTree.setEditable(false);
+ // messageTree.setRootVisible(false);
+
+ textOut = new JTextPane(docOut);
+ textOut.setEditable(false);
+
+ jspIn = new JScrollPane();
+ jspIn.getViewport().add(messageTree);
+
+ jspOut = new JScrollPane();
+ jspOut.getViewport().add(textOut);
+
+ principalPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jspIn, jspOut);
+ principalPanel.setOneTouchExpandable(true);
+ principalPanel.setDividerLocation(500);
+
+ getContentPane().add(principalPanel);
+ }
+
+ public void initStyleForEditing(){
+// DEFAULT STYLE
+ Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
+ docOut = new DefaultStyledDocument();
+ // other style could be define later // COMMENT TO BE DELETED AFTER DEV
+
+ boldItalicRedText = new SimpleAttributeSet();
+ StyleConstants.setForeground(boldItalicRedText, Color.red);
+ StyleConstants.setBold(boldItalicRedText, true);
+ StyleConstants.setItalic(boldItalicRedText, true);
+ StyleConstants.setFontSize(boldItalicRedText, 12);
+
+ boldItalicBlueText = new SimpleAttributeSet();
+ StyleConstants.setForeground(boldItalicBlueText, Color.blue);
+ StyleConstants.setBold(boldItalicBlueText, true);
+ StyleConstants.setItalic(boldItalicBlueText, true);
+ StyleConstants.setFontSize(boldItalicBlueText, 12);
+
+ boldText = new SimpleAttributeSet();
+ StyleConstants.setFontSize(boldText, 14);
+ StyleConstants.setBold(boldText, true);
+
+ pduStyle = new SimpleAttributeSet();
+ StyleConstants.setFontSize(pduStyle, 12);
+ StyleConstants.setBold(pduStyle, true);
+ StyleConstants.setForeground(pduStyle, Color.DARK_GRAY);
+
+
+ }
+
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void launchLdapProxy(String[] args) {
+ ldapProxy = new LdapProxy();
+ ldapProxy.setMainFrame(this);
+ // ldapProxy.setTextIn( messageTree );
+ // ldapProxy.setTextOut( textOut );
+
+ ldapProxy.likeMain(args);
+
+ }
+
+ /** Returns an ImageIcon, or null if the path was invalid. */
+ protected static ImageIcon createImageIcon(String path) {
+ // java.net.URL imgURL = MainFrame.class.getResource(path);
+ try {
+ return new ImageIcon(path);
+ } catch (Exception e) {
+ return null;
+ }
+ /*
+ * if (imgURL != null) { return new ImageIcon(imgURL); } else {
+ * System.err.println("Couldn't find file: " + path); return null; }
+ */
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void initRenderTree() {
+ ImageIcon leafIcon = createImageIcon("./images/gnome-icone-001.gif");
+ ImageIcon icon = createImageIcon("./images/gnome-icone-002.gif");
+ if ((leafIcon != null) && (icon != null)) {
+ DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
+ renderer.setLeafIcon(leafIcon);
+ messageTree.setCellRenderer(renderer);
+ renderer.setFont(new Font("treeFont", Font.BOLD, 12));
+ renderer.setBackgroundNonSelectionColor(Color.lightGray);
+ renderer.setBackgroundSelectionColor(Color.white);
+ renderer.setOpenIcon(icon);
+ renderer.setClosedIcon(icon);
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private JMenuBar initMenuBar() {
+ file.add(newMenu);
+ file.add(load);
+ file.add(save);
+ file.addSeparator();
+ file.add(quit);
+ newMenu.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent action) {
+ //top.removeAllChildren();
+ // TO DO BETTER !!!!!
+ top = new DefaultMutableTreeNode("Start");
+ treeModel.setRoot(top);
+ }
+ });
+ save.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent action) {
+ try {
+ FileWriter fw = new FileWriter(new File("./dest/testsauv.xml"));
+ for (int i = 0; i < ldapMessageTree.getChildCount(); i++) {
+ DefaultMutableTreeNode tmpNode = (DefaultMutableTreeNode) ldapMessageTree
+ .getChildAt(i);
+ String st = toXML(tmpNode.getUserObject(), fw) + "\n";
+ try {
+ docOut.insertString(docOut.getLength(), st, boldText);
+ } catch (BadLocationException ble) {
+ }
+ for (int j = 0; j < tmpNode.getChildCount(); j++) {
+ st = toXML(((DefaultMutableTreeNode) tmpNode.getChildAt(j))
+ .getUserObject(), fw)
+ + "\n";
+ try {
+ docOut.insertString(docOut.getLength(), st, boldItalicBlueText);
+ } catch (BadLocationException ble) {
+ }
+ }
+ }
+
+ } catch (IOException e) {
+ }
+ }
+ });
+ quit.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent action) {
+ System.out.println("EXIT");
+ try {
+ if (ldapProxy != null)
+ ldapProxy.stop();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.exit(0);
+ }
+ });
+
+ quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
+ save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
+
+ edit.add(pduView);
+
+ menuBar.add(file);
+ menuBar.add(edit);
+ return menuBar;
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void run() {
+ this.setVisible(true);
+ this.launchLdapProxy(args);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param args
+ */
+ public static void main(String[] args) throws Exception {
+ MainFrame mf = new MainFrame();
+ mf.args = args;
+ mf.run();
+ }
+
+ public JTree getMessageTree() {
+ return messageTree;
+ }
+
+ public DefaultMutableTreeNode getTop() {
+ return top;
+ }
+
+ public DefaultMutableTreeNode getLdapMessageTree() {
+ return ldapMessageTree;
+ }
+
+ public void setLdapMessageTree(DefaultMutableTreeNode ldapMessageTree) {
+ this.ldapMessageTree = ldapMessageTree;
+ }
+
+ public SimpleAttributeSet getStyleByMessageType(int type) {
+ SimpleAttributeSet styledType;
+
+ switch (type) {
+ case 0:
+ styledType = boldItalicBlueText;
+ break;
+ case 1:
+ styledType = boldItalicBlueText;
+ break;
+ case 2:
+ styledType = boldItalicBlueText;
+ break;
+ case 3:
+ styledType = boldItalicRedText;
+ break;
+ case 4:
+ styledType = boldItalicBlueText;
+ break;
+ case 5:
+ styledType = boldItalicBlueText;
+ break;
+ case 6:
+ styledType = boldItalicBlueText;
+ break;
+ case 7:
+ styledType = boldItalicBlueText;
+ break;
+ case 8:
+ styledType = boldItalicBlueText;
+ break;
+ case 9:
+ styledType = boldItalicBlueText;
+ break;
+ case 10:
+ styledType = boldItalicBlueText;
+ break;
+ case 11:
+ styledType = boldItalicBlueText;
+ break;
+ case 12:
+ styledType = boldItalicBlueText;
+ break;
+ case 13:
+ styledType = boldItalicBlueText;
+ break;
+ case 14:
+ styledType = boldItalicBlueText;
+ break;
+ case 15:
+ styledType = boldItalicBlueText;
+ break;
+ case 16:
+ styledType = boldItalicBlueText;
+ break;
+ case 17:
+ styledType = boldItalicRedText;
+ break;
+ case 18:
+ styledType = boldItalicBlueText;
+ break;
+ case 19:
+ styledType = boldItalicBlueText;
+ break;
+ case -1:
+ styledType = boldItalicBlueText;
+ break;
+
+ default:
+ styledType = boldItalicBlueText;
+ break;
+ }
+ return styledType;
+ }
+
+ public String toXML(Object ob, FileWriter fw) {
+ try {
+ XStream xs = new XStream();
+ xs.toXML(ob, fw);
+ String st = xs.toXML(ob);
+ System.out.println(st);
+ return st;
+ } catch (Exception e) {
+ return "NOTHING";
+ }
+ }
+
+ public MainFrame getItSelf() {
+ return itSelf;
+ }
+
+ public void setItSelf(MainFrame itSelf) {
+ this.itSelf = itSelf;
+ }
+
+ public void treeCollapsed(TreeExpansionEvent tee) {
+ messageTree.setSelectionPath(tee.getPath());
+ // messageTree.setSelectionRow(0);
+
+ }
+
+ public void treeExpanded(TreeExpansionEvent tee) {
+ // messageTree.setSelectionRow(0);
+ messageTree.setSelectionPath(tee.getPath());
+ }
+
+ public void valueChanged(TreeSelectionEvent tse) {
+ textOut.setText("");
+ // there is only 2 depth level in thoses Tree.
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) messageTree
+ .getLastSelectedPathComponent();
+ if (node.equals(top)) {
+ System.out.println("First Element Selected!!");
+ return;
+ }
+ if (node == null) {
+ System.out.println("Can't Find Node !!! NULL");
+ return;
+
+ }
+ int index = top.getIndex(node);
+ int count = 0;
+ int childrenCount = top.getChildCount();
+ while ((index == -1) && (count < childrenCount)) {
+ index = top.getChildAt(count).getIndex(node);
+ count++;
+ }
+ count--;
+ if (index == -1) {
+ System.out.println("Can't Find Node !!! index -1");
+ return;
+ }
+ Object nodeInfo = node.getUserObject();
+ System.out.println("============================================");
+ System.out.println("NODE selected " + index + " :::: " + nodeInfo.toString());
+ TreeNode ldapNode;
+ if (!node.isLeaf()) {
+ // First Level
+ ldapNode = ldapMessageTree.getChildAt(index);
+ } else {
+ // second Level we take before the good sub tree to get the
+ // good leaf by its own index
+ ldapNode = ldapMessageTree.getChildAt(count).getChildAt(index);
+ }
+
+ System.out.println("LDAP message associate ::: "
+ + ((LdapMessageWithPDU) ((DefaultMutableTreeNode) ldapNode).getUserObject())
+ .getLdapMessage().toString());
+ System.out.println("============================================");
+
+ // textOut.setLogicalStyle(textOut.getStyle("regular"));
+ // textOut.setText(textOut.getText() + ldapNode.toString());
+ try {
+ LdapMessage ldapmess = ((LdapMessageWithPDU) ((DefaultMutableTreeNode) ldapNode)
+ .getUserObject()).getLdapMessage();
+ int type = ldapmess.getMessageType();
+ SimpleAttributeSet currentStyle = getStyleByMessageType(type);
+ docOut.insertString(docOut.getLength(), node.toString() + "\n", boldText);
+ if (node.isLeaf()) {
+ docOut.insertString(docOut.getLength(), ldapmess.toString(), currentStyle);
+ if(pduView.getState()){
+ docOut.insertString(docOut.getLength(),SEPARATOR + " PDU :: \n " +((LdapMessageWithPDU) ((DefaultMutableTreeNode) ldapNode)
+ .getUserObject()).getDumpBytes() + SEPARATOR, pduStyle);
+ }
+ }
+
+
+ } catch (Exception e) {// BadLocationException ble) {
+ System.err.println("Can not write data in Editor!!");
+ }
+
+ }
+
+ public DefaultTreeModel getTreeModel() {
+ return treeModel;
+ }
+
+}
Added: directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapMessageWithPDU.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapMessageWithPDU.java?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapMessageWithPDU.java (added)
+++ directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapMessageWithPDU.java Mon Sep 5 14:52:56 2005
@@ -0,0 +1,37 @@
+package org.apache.ldap.proxy.impl;
+
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+
+public class LdapMessageWithPDU {
+
+ private String dumpBytes;
+
+ private LdapMessage ldapMessage;
+
+ 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;
+ }
+
+}
Added: directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapProxy.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapProxy.java?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapProxy.java (added)
+++ directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/LdapProxy.java Mon Sep 5 14:52:56 2005
@@ -0,0 +1,108 @@
+package org.apache.ldap.proxy.impl;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.apache.ldap.proxy.gui.MainFrame;
+
+public class LdapProxy {
+
+ public static final String usageArgs = " <localport> <host> <port> <timeout_ms>";
+
+ static int clientCount;
+
+ private ProxyConnection proxyConnection;
+
+ MainFrame mainFrame;
+
+ public static synchronized void quit(long t) {
+ System.out.println("...quit after waiting " + t + " ms");
+ clientCount--;
+ }
+
+ public void run(int localport, String host, int port, long timeout) {
+ try {
+ ServerSocket sSocket = new ServerSocket(localport);
+
+ while (true) {
+ Socket cSocket = null;
+ try {
+ System.out.println("listening...");
+ cSocket = sSocket.accept();
+
+ if (cSocket != null) {
+ clientCount++;
+ System.out.println("accepted as #" + clientCount + ":" + cSocket);
+ proxyConnection = new ProxyConnection(cSocket, host, port, timeout);
+ proxyConnection.setMainFrame(mainFrame);
+ proxyConnection.run();
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ try {
+ cSocket.close();
+ } catch (Exception e) {
+ // fall thru
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ }
+ }
+
+ public void stop() {
+ proxyConnection.interrupt();
+ }
+
+ public static void main(String[] argv) {
+ LdapProxy self = new LdapProxy();
+
+ if (argv.length >= 3) {
+ int localport = Integer.parseInt(argv[0]);
+ String url = argv[1];
+ int port = Integer.parseInt(argv[2]);
+ int timeout = 300000;
+ if (argv.length >= 4) {
+ try {
+ timeout = Integer.parseInt(argv[3]);
+ } catch (Exception e) {
+ System.err.println("Time Out incorrect in lanched command line!! TIMEOUT = "
+ + argv[3]);
+ }
+ }
+ if (timeout == 0)
+ timeout = 300000;
+ self.run(localport, url, port, timeout);
+ } else {
+ System.err.println("usage: java " + self.getClass().getName() + usageArgs);
+ }
+ }
+
+ /*
+ * public void setTextIn(JTextPane textIn) { LdapProxy.textIn = textIn; }
+ * public void setTextOut(JTextPane textOut) { LdapProxy.textOut = textOut; }
+ */
+ public void likeMain(String[] argv) {
+ if (argv.length >= 3) {
+ int localport = Integer.parseInt(argv[0]);
+ String url = argv[1];
+ int port = Integer.parseInt(argv[2]);
+ int timeout = 30000;
+
+ try {
+ timeout = Integer.parseInt(argv[3]);
+ } catch (Exception e) {
+ }
+
+ run(localport, url, port, timeout);
+ } else {
+ System.err.println("usage: java " + this.getClass().getName() + usageArgs);
+ }
+ }
+
+ public void setMainFrame(MainFrame mainframe) {
+ this.mainFrame = mainframe;
+ }
+
+}// class
Added: directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/ProxyConnection.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/ProxyConnection.java?rev=278864&view=auto
==============================================================================
--- directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/ProxyConnection.java (added)
+++ directory/sandbox/trunk/proxy/src/java/main/org/apache/ldap/proxy/impl/ProxyConnection.java Mon Sep 5 14:52:56 2005
@@ -0,0 +1,353 @@
+package org.apache.ldap.proxy.impl;
+
+import java.io.BufferedOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+
+import java.util.Date;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.asn1.codec.DecoderException;
+import org.apache.asn1new.ber.Asn1Decoder;
+import org.apache.asn1new.ber.containers.IAsn1Container;
+import org.apache.asn1new.ldap.codec.LdapDecoder;
+import org.apache.asn1new.ldap.codec.LdapMessageContainer;
+import org.apache.asn1new.ldap.pojo.LdapMessage;
+import org.apache.asn1new.util.StringUtils;
+import org.apache.ldap.proxy.gui.MainFrame;
+
+class ProxyConnection extends Thread {
+
+ Socket fromClient;
+
+ String host;
+
+ int port;
+
+ long timeout;
+
+ MainFrame mainFrame;
+
+ int lastMessageId = -1;
+
+ DefaultMutableTreeNode lastNode;
+
+ DefaultMutableTreeNode lastMessNode;
+
+ int currentCount = 0;
+
+ ProxyConnection(Socket s, String host, int port, long timeout) {
+ fromClient = s;
+ this.host = host;
+ this.port = port;
+ this.timeout = timeout;
+
+ }
+
+ private String decode(ByteBuffer buffer) throws DecoderException {
+
+ 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.setDumpBytes(org.apache.asn1new.util.StringUtils.dumpBytes(buffer.array()));
+ message.setLdapMessage(ldapmessage);
+ message.setMessageId(ldapmessage.getMessageId());
+
+ // Ici on test pour ne pas créer 2 entré avec le meme messageID;
+ 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 = message.getProtocolOp().getClass().getSimpleName();
+ String type = transformToStringType(ldapmessage.getMessageType());
+
+ // DefaultMutableTreeNode request = new DefaultMutableTreeNode(type +"
+ // ==>" + message.toString());
+ DefaultMutableTreeNode request = new DefaultMutableTreeNode(type + " N° " + currentCount);
+ // mess.add(request);
+ mainFrame.getTreeModel().insertNodeInto(request, mess, mess.getChildCount());
+
+ messTrue.add(new DefaultMutableTreeNode(message));
+
+ // mainFrame.repaint();
+ // mainFrame.getTreeModel().reload(mainFrame.getTop());
+ return message.getLdapMessage().toString();
+ }
+
+ public String transformToStringType(int type) {
+ String stringType;
+
+ switch (type) {
+ case 0:
+ stringType = "ABANDON REQUEST";
+ break;
+ case 1:
+ stringType = "ADD REQUEST";
+ break;
+ case 2:
+ stringType = "ADD RESPONSE";
+ break;
+ case 3:
+ stringType = "BIND REQUEST";
+ break;
+ case 4:
+ stringType = "BIND RESPONSE";
+ break;
+ case 5:
+ stringType = "COMPARE REQUEST";
+ break;
+ case 6:
+ stringType = "COMPARE RESPONSE";
+ break;
+ case 7:
+ stringType = "DEL REQUEST";
+ break;
+ case 8:
+ stringType = "DEL RESPONSE";
+ break;
+ case 9:
+ stringType = "EXTENDED REQUEST";
+ break;
+ case 10:
+ stringType = "EXTENDED RESPONSE";
+ break;
+ case 11:
+ stringType = "MODIFYDN REQUEST";
+ break;
+ case 12:
+ stringType = "MODIFYDN RESPONSE";
+ break;
+ case 13:
+ stringType = "MODIFY REQUEST";
+ break;
+ case 14:
+ stringType = "MODIFY RESPONSE";
+ break;
+ case 15:
+ stringType = "SEARCH REQUEST";
+ break;
+ case 16:
+ stringType = "SEARCH RESULT DONE";
+ break;
+ case 17:
+ stringType = "SEARCH RESULT ENTRY";
+ break;
+ case 18:
+ stringType = "SEARCH RESULT REFERENCE";
+ break;
+ case 19:
+ stringType = "UNBIND REQUEST";
+ break;
+ case -1:
+ stringType = "UNKNOWN";
+ break;
+
+ default:
+ stringType = "UNKNOWN";
+ break;
+ }
+ return stringType;
+ }
+
+ public void run() {
+ InputStream clientIn = null;
+ OutputStream clientOut = null;
+ InputStream serverIn = null;
+ OutputStream serverOut = null;
+ Socket toServer = null;
+ int r0 = -1;
+ int r1 = -1;
+ int ch = -1;
+ int i = -1;
+ long time0 = System.currentTimeMillis();
+ long time1 = time0 + timeout;
+
+ try {
+ toServer = new Socket(host, port);
+ System.out.println("open connection to:" + toServer + "(timeout=" + timeout + " ms)");
+ clientIn = fromClient.getInputStream();
+ clientOut = new BufferedOutputStream(fromClient.getOutputStream());
+ serverIn = toServer.getInputStream();
+ serverOut = new BufferedOutputStream(toServer.getOutputStream());
+
+ while (r0 != 0 || r1 != 0 || (time1 - time0) <= timeout) {
+ r0 = clientIn.available();
+
+ if (r0 != 0) {
+ System.out.println("");
+ // LdapProxy.setTextIn("<<<" + r0 + " bytes from client
+ // \n","red");
+ System.out.println("");
+ System.out.println("<<<" + r0 + " bytes from client");
+ System.out.println("<<<" + r1 + " bytes from server");
+ }
+
+ ByteBuffer bb = null;
+
+ while ((r0 = clientIn.available()) > 0) {
+ byte[] in = new byte[r0];
+ int k = 0;
+
+ for (i = 0; i < r0; i++) {
+ ch = clientIn.read();
+
+ if (ch != -1) {
+ in[k++] = (byte) ch;
+ serverOut.write(ch);
+ } else {
+ System.out.println("client stream closed");
+ // LdapProxy.setTextIn("client stream closed
+ // \n","redbold");
+ }
+ }
+
+ bb = ByteBuffer.allocate(r0);
+ bb.put(in);
+ bb.flip();
+ String result = decode(bb);
+ /*
+ * LdapProxy.setTextIn("--->>>\n", "regular");
+ * LdapProxy.setTextIn(result, "regular");
+ * LdapProxy.setTextIn("----------------------------------\n",
+ * "regular");
+ */
+
+ time0 = System.currentTimeMillis();
+ serverOut.flush();
+ }
+
+ bb = null;
+
+ while ((r1 = serverIn.available()) > 0) {
+ System.out.println("");
+ System.out.println(">>>" + r1 + " bytes from server");
+ // LdapProxy.setTextOut(">>>" + r1 + " bytes from server
+ // \n","red");
+ System.out.println("");
+ System.out.println(">>>" + r1 + " bytes from server");
+
+ byte[] out = new byte[r1];
+ int k = 0;
+
+ for (i = 0; i < r1; i++) {
+ ch = serverIn.read();
+
+ if (ch != -1) {
+ out[k++] = (byte) ch;
+ } else {
+ System.out.println("server stream closed");
+ // LdapProxy.setTextOut("server stream closed
+ // \n","redbold");
+ break;
+ }
+
+ clientOut.write(ch);
+ }
+
+ bb = ByteBuffer.allocate(r1);
+ bb.put(out);
+ bb.flip();
+
+ while (true) {
+ try {
+ String result = decode(bb);
+ System.out.println(result);
+ /*
+ * LdapProxy.setTextOut("<<<---\n", "blue");
+ * LdapProxy.setTextOut(result, "blue");
+ * LdapProxy.setTextOut("----------------------------------\n",
+ * "regular");
+ */
+ if (bb.hasRemaining() == false) {
+ break;
+ }
+ } catch (DecoderException de) {
+ StringBuffer result = new StringBuffer();
+ result.append(de.getMessage()).append('\n');
+
+ byte[] tmp = new byte[out.length - bb.position()];
+ System
+ .arraycopy(out, bb.position(), tmp, 0, out.length
+ - bb.position());
+ result.append(StringUtils.dumpBytes(tmp));
+
+ System.out.println(result);
+ /*
+ * LdapProxy.setTextOut("<<<---\n", "regular");
+ * LdapProxy.setTextOut(new String(tmp), "regular");
+ * LdapProxy.setTextOut("----------------------------------\n",
+ * "regular");
+ */
+ break;
+ }
+ }
+
+ time0 = new Date().getTime();
+ clientOut.flush();
+ }
+ if (r0 == 0 && r1 == 0) {
+ time1 = new Date().getTime();
+ Thread.sleep(100);
+ // Proxy.display("waiting:"+(time1-time0)+" ms");
+ }
+ }
+ } catch (Throwable t) {
+ System.out.println("i=" + i + " ch=" + ch);
+ t.printStackTrace(System.err);
+ } finally {
+ try {
+ clientIn.close();
+ clientOut.close();
+ serverIn.close();
+ serverOut.close();
+ fromClient.close();
+ toServer.close();
+ LdapProxy.quit(time1 - time0);
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ }
+ }
+ }
+
+ /*
+ * public void setTextIn(JTextPane textIn) { this.textIn = textIn; } public
+ * void setTextOut(JTextPane textOut) { this.textOut = textOut; }
+ */
+
+ public void setMainFrame(MainFrame mainframe) {
+ this.mainFrame = mainframe;
+ }
+}
\ No newline at end of file