From 1eb7fb4d54021e8fa48d8b70215808593f8f02b3 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 11 Oct 2013 13:39:43 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-175: Decouple OpenDJ LDAP SDK from Grizzly

---
 opendj3/opendj-ldap-sdk-examples/pom.xml           |   15 -
 opendj3/opendj-ldap-sdk/dependency-reduced-pom.xml |  135 ++++++++++++++++++++++
 /dev/null                                          |  112 ------------------
 opendj3/opendj-ldap-sdk/pom.xml                    |   67 +++++++----
 4 files changed, 182 insertions(+), 147 deletions(-)

diff --git a/opendj3/opendj-grizzly/src/main/javadoc/overview.html b/opendj3/opendj-grizzly/src/main/javadoc/overview.html
deleted file mode 100644
index 69b8d30..0000000
--- a/opendj3/opendj-grizzly/src/main/javadoc/overview.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<body>
-    The OpenDJ SDK for Java provides a high performance easy to use
-    library of classes and interfaces for accessing and implementing
-    LDAP Directory Services as defined in <a
-      href="http://tools.ietf.org/html/rfc4510">RFC 4510</a>.
-    <br>
-    For an introduction to LDAP, read the <em>OpenDJ SDK Developer's Guide</em>
-    chapter on <a
-      href="http://opendj.forgerock.org/doc/dev-guide/index.html#chap-understanding-ldap"
-    >Understanding LDAP</a>. Also see the chapter on <a
-      href="http://opendj.forgerock.org/doc/dev-guide/index.html#chap-best-practices"
-    >Best Practices For LDAP Application Developers</a>.
-    <br>
-    <h1>Getting Started</h1>
-    The following example shows how the OpenDJ SDK may be used to
-    connect to a directory server, authenticate, and then perform a
-    search. The search results are output as LDIF to the standard
-    output:
-    <br>
-    <table width="100%">
-      <tbody>
-        <tr>
-         <td>
-          <pre>    // Create an LDIF writer which will write the search results to stdout.
-    final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
-    Connection connection = null;
-    try
-    {
-      // Connect and bind to the server.
-      final LDAPConnectionFactory factory = new LDAPConnectionFactory("localhost", 1389);
-
-      connection = factory.getConnection();
-      connection.bind(userName, password);
-
-      // Read the entries and output them as LDIF.
-      final ConnectionEntryReader reader = connection.search(baseDN, scope, filter, attributes);
-      while (reader.hasNext())
-      {
-        if (reader.isEntry())
-        {
-          // Got an entry.
-          final SearchResultEntry entry = reader.readEntry();
-          writer.writeComment("Search result entry: " + entry.getName().toString());
-          writer.writeEntry(entry);
-        }
-        else
-        {
-          // Got a continuation reference.
-          final SearchResultReference ref = reader.readReference();
-          writer.writeComment("Search result reference: " + ref.getURIs().toString());
-        }
-      }
-      writer.flush();
-    }
-    catch (final Exception e)
-    {
-      // Handle exceptions...
-      System.err.println(e.getMessage());
-    }
-    finally
-    {
-      if (connection != null)
-      {
-        connection.close();
-      }
-    }</pre>
-       </td>
-        </tr>
-      </tbody>
-    </table>
-    <br><!-- It seems the .zip is not packaged with the SDK. -->
-    Additional examples can be found online at the <a
-      href="http://opendj.forgerock.org/opendj-ldap-sdk-examples/"
-    >OpenDJ LDAP SDK Examples</a> site.
-    <br>
-    <h1>Creating Connections</h1>
-    The following classes can be used to create and manage connections to
-    LDAP directory servers:
-    <ul>
-      <li>{@link org.forgerock.opendj.ldap.LDAPConnectionFactory}</li>
-      <li>{@link org.forgerock.opendj.ldap.Connection}</li>
-      <li>{@link org.forgerock.opendj.ldap.Connections}</li>
-    </ul>
-    <br>
-    <h1>Creating Requests</h1>
-    The following classes can be used to create LDAP requests:
-    <ul>
-      <li>{@link org.forgerock.opendj.ldap.requests.Requests}</li>
-      <li>{@link org.forgerock.opendj.ldap.requests.Request}</li>
-    </ul>
-    <br>
-    <h1>Using Controls</h1>
-    Common LDAP control implementations can be found in
-    {@link org.forgerock.opendj.ldap.controls}.
-    <br>
-    <h1>Core Types</h1>
-    The following classes and interfaces represent core types:
-    <ul>
-      <li>{@link org.forgerock.opendj.ldap.AttributeDescription}</li>
-      <li>{@link org.forgerock.opendj.ldap.Attribute}</li>
-      <li>{@link org.forgerock.opendj.ldap.DN}</li>
-      <li>{@link org.forgerock.opendj.ldap.Entry}</li>
-      <li>{@link org.forgerock.opendj.ldap.Filter}</li>
-    </ul>
-    <br>
-@see <a href="http://tools.ietf.org/html/rfc4511">RFC 4511 - Lightweight
-      Directory Access Protocol (LDAP): The Protocol </a>
-@see org.forgerock.opendj.ldap
-</body>
-</html>
diff --git a/opendj3/opendj-ldap-sdk-examples/pom.xml b/opendj3/opendj-ldap-sdk-examples/pom.xml
index 7dfd440..6cec928 100644
--- a/opendj3/opendj-ldap-sdk-examples/pom.xml
+++ b/opendj3/opendj-ldap-sdk-examples/pom.xml
@@ -53,20 +53,9 @@
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
         <configuration>
           <createDependencyReducedPom>false</createDependencyReducedPom>
-          <artifactSet>
-            <excludes>
-              <!--  avoid duplicate classes, as opendj-ldap-sdk already contains them -->
-              <exclude>org.forgerock.opendj:opendj-core</exclude>
-              <exclude>org.forgerock.opendj:opendj-grizzly</exclude>
-            </excludes>
-          </artifactSet>
         </configuration>
         <executions>
           <execution>
@@ -77,6 +66,10 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+      </plugin>
     </plugins>
   </build>
   <reporting>
diff --git a/opendj3/opendj-ldap-sdk/dependency-reduced-pom.xml b/opendj3/opendj-ldap-sdk/dependency-reduced-pom.xml
new file mode 100644
index 0000000..ae25462
--- /dev/null
+++ b/opendj3/opendj-ldap-sdk/dependency-reduced-pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>opendj-project</artifactId>
+    <groupId>org.forgerock.opendj</groupId>
+    <version>2.7.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>opendj-ldap-sdk</artifactId>
+  <name>OpenDJ SDK</name>
+  <description>This module provides a complete LDAP SDK for developing LDAP Directory
+    client and server applications. It includes both the core APIs and a
+    default Grizzly based network transport.</description>
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-shade-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <createSourcesJar>true</createSourcesJar>
+          <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+          <artifactSet>
+            <includes>
+              <include>org.forgerock.opendj:opendj-core</include>
+              <include>org.forgerock.opendj:opendj-grizzly</include>
+            </includes>
+          </artifactSet>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>com.github.goldin</groupId>
+        <artifactId>copy-maven-plugin</artifactId>
+        <version>0.2.5</version>
+        <executions>
+          <execution>
+            <id>unpack-jar-to-classes</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <resource>
+                <targetPath>${project.build.outputDirectory}</targetPath>
+                <file>${project.build.directory}/${project.build.finalName}.jar</file>
+                <unpack>true</unpack>
+              </resource>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>bundle</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <instructions>
+            <Include-Resource>META-INF/services=target/classes/META-INF/services</Include-Resource>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.forgerock.commons</groupId>
+      <artifactId>i18n-core</artifactId>
+      <version>1.4.0</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.5</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.glassfish.grizzly</groupId>
+      <artifactId>grizzly-framework</artifactId>
+      <version>2.3.6</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>mailing-list</report>
+              <report>issue-tracking</report>
+              <report>license</report>
+              <report>cim</report>
+              <report>distribution-management</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+      <plugin>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <links>
+            <link>http://commons.forgerock.org/i18n-framework/i18n-core/apidocs</link>
+          </links>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+  <properties>
+    <opendj.osgi.import>com.sun.security.auth*;resolution:=optional,
+      *</opendj.osgi.import>
+  </properties>
+</project>
+
diff --git a/opendj3/opendj-ldap-sdk/pom.xml b/opendj3/opendj-ldap-sdk/pom.xml
index 4d54096..2823347 100644
--- a/opendj3/opendj-ldap-sdk/pom.xml
+++ b/opendj3/opendj-ldap-sdk/pom.xml
@@ -59,47 +59,66 @@
   </properties>
   <build>
     <plugins>
-      <!-- Unpack opendj-core and opendj-grizzly to rebuild an unified jar with bundle -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>2.8</version>
+        <artifactId>maven-shade-plugin</artifactId>
+        <configuration>
+          <createSourcesJar>true</createSourcesJar>
+          <promoteTransitiveDependencies>true</promoteTransitiveDependencies>          
+          <artifactSet>
+            <includes>
+              <include>org.forgerock.opendj:opendj-core</include>
+              <include>org.forgerock.opendj:opendj-grizzly</include>
+            </includes>
+          </artifactSet>
+        </configuration>
         <executions>
           <execution>
-            <id>unpack-dependencies</id>
             <phase>package</phase>
             <goals>
-              <goal>unpack-dependencies</goal>
+              <goal>shade</goal>
             </goals>
-            <configuration>
-              <includeArtifactIds>opendj-grizzly, opendj-core</includeArtifactIds>
-              <includes>**/*.class,**\/services\/*</includes>
-              <excludes>**/*.properties</excludes>
-              <outputDirectory>${project.build.directory}/classes</outputDirectory>
-              <overWriteReleases>false</overWriteReleases>
-              <overWriteSnapshots>true</overWriteSnapshots>
-              <excludeTransitive>true</excludeTransitive>
-            </configuration>
           </execution>
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
+        <groupId>com.github.goldin</groupId>
+		    <artifactId>copy-maven-plugin</artifactId>
+		    <version>0.2.5</version>
         <executions>
           <execution>
+            <id>unpack-jar-to-classes</id>
             <phase>package</phase>
             <goals>
-              <goal>bundle</goal>
+              <goal>copy</goal>
             </goals>
+            <configuration>
+              <resource>
+	              <targetPath>${project.build.outputDirectory}</targetPath>
+	              <file>${project.build.directory}/${project.build.finalName}.jar</file>
+	              <unpack>true</unpack>
+              </resource>
+            </configuration>
           </execution>
-        </executions>
-        <configuration>
-          <instructions>
-            <Include-Resource>META-INF/services=target/classes/META-INF/services</Include-Resource>
-          </instructions>
-        </configuration>
+        </executions>         
+      </plugin>
+      <plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>bundle</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<instructions>
+						<Include-Resource>META-INF/services=target/classes/META-INF/services</Include-Resource>
+					</instructions>
+				</configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>

--
Gitblit v1.10.0