From d07ce77c50877dbae6d2e9f437f71c836d76418b Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 17 Sep 2007 19:21:15 +0000
Subject: [PATCH] Add a new build-tools source stub for the netscape.ldap.LDAPSocketFactory class that is part of the Mozilla LDAP SDK for Java. Also, use this source stub to create the org.opends.server.protocols.internal.InternalMozillaLDAPSocketFactory class which implements that interface and allows users to more easily use the Mozilla LDAP SDK for Java to invoke internal operations in the server.
---
opends/src/server/org/opends/server/protocols/internal/InternalMozillaLDAPSocketFactory.java | 84 +++++++++++++++++++++
opends/src/build-tools/netscape/ldap/package-info.java | 42 ++++++++++
opends/build.xml | 4 +
opends/src/build-tools/netscape/ldap/LDAPSocketFactory.java | 53 +++++++++++++
4 files changed, 183 insertions(+), 0 deletions(-)
diff --git a/opends/build.xml b/opends/build.xml
index d3af905..ba93fc8 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -1016,6 +1016,10 @@
<include name="*.jar" />
</fileset>
+ <fileset dir="${build.dir}/build-tools">
+ <include name="*.jar" />
+ </fileset>
+
<dirset dir="${classes.dir}" />
<dirset dir="${dsml.classes.dir}" />
<dirset dir="${quicksetup.classes.dir}" />
diff --git a/opends/src/build-tools/netscape/ldap/LDAPSocketFactory.java b/opends/src/build-tools/netscape/ldap/LDAPSocketFactory.java
new file mode 100644
index 0000000..6bb7ea9
--- /dev/null
+++ b/opends/src/build-tools/netscape/ldap/LDAPSocketFactory.java
@@ -0,0 +1,53 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+package netscape.ldap;
+
+
+
+import java.net.Socket;
+
+
+
+/**
+ * This class provides an empty definition of the
+ * {{netscape.ldap.LDAPSocketFactory}} interface, which is part of the Mozilla
+ * LDAP SDK for Java. It is provided to allow the
+ * {{org.opends.server.protocols.internal.InternalMozillaLDAPSocketFactory}}
+ * class to compile without creating a dependency on the full Mozilla LDAP SDK
+ * for Java.
+ * <BR><BR>
+ * Note that we do not intend to distribute the Mozilla LDAP SDK for Java with
+ * OpenDS, or do we depend on it in any way. Any third-party applications which
+ * intend to use the
+ * {{org.opends.server.protocols.internal.InternalMozillaLDAPSocketFactory}}
+ * class will be required to provide the Mozilla LDAP SDK for Java library.
+ */
+public interface LDAPSocketFactory
+{
+ public Socket makeSocket(String host, int port);
+}
+
diff --git a/opends/src/build-tools/netscape/ldap/package-info.java b/opends/src/build-tools/netscape/ldap/package-info.java
new file mode 100644
index 0000000..a66e8c8
--- /dev/null
+++ b/opends/src/build-tools/netscape/ldap/package-info.java
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+
+
+/**
+ * This package provides a source file stub for the LDAPSocketFactory class
+ * that is part of the Mozilla LDAP SDK for Java and is required to build the
+ * org.opends.server.protocols.internal.InternalMozillaLDAPSocketFactory class.
+ * This class provides a simple way to use the Mozilla LDAP SDK for Java to
+ * perform internal operations in OpenDS.
+ *
+ * This code is not acutally used in any way other than to allow other code to
+ * compile, and it should not be included in any JAR files or other bundles
+ * that we ship as part of OpenDS.
+ */
+package netscape.ldap;
+
diff --git a/opends/src/server/org/opends/server/protocols/internal/InternalMozillaLDAPSocketFactory.java b/opends/src/server/org/opends/server/protocols/internal/InternalMozillaLDAPSocketFactory.java
new file mode 100644
index 0000000..3e147a3
--- /dev/null
+++ b/opends/src/server/org/opends/server/protocols/internal/InternalMozillaLDAPSocketFactory.java
@@ -0,0 +1,84 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.server.protocols.internal;
+
+
+
+import java.net.Socket;
+
+import netscape.ldap.LDAPSocketFactory;
+
+
+
+/**
+ * This class provides an implementation of the
+ * {{netscape.ldap.LDAPSocketFactory}} class that can be used to allow
+ * the Mozilla LDAP SDK for Java to perform internal operations in
+ * OpenDS. To use it, simply provide an instance of this class to the
+ * constructor of the {{netscape.ldap.LDAPConnection}} class, like:
+ * <PRE>
+ * LDAPConnection conn =
+ * new LDAPConnection(new InternalMozillaLDAPSocketFactory());
+ * </PRE>
+ */
+public final class InternalMozillaLDAPSocketFactory
+ implements LDAPSocketFactory
+{
+ /**
+ * Creates a new instance of this internal Mozilla LDAP socket
+ * factory.
+ */
+ public InternalMozillaLDAPSocketFactory()
+ {
+ // No implementation is required.
+ }
+
+
+
+ /**
+ * Creates and returns a new internal LDAP socket, which can be used
+ * by the Mozilla LDAP SDK for Java to perform internal operations
+ * in OpenDS.
+ *
+ * @param host The address of the server to which the connection
+ * should be established. This will be ignored, since
+ * there will not be any actual network communication.
+ * @param port The port of the server to which the connection
+ * should be established. This will be ignored, since
+ * there will not be any actual network communication.
+ *
+ * @return An internal LDAP socket, which can be used by the
+ * Mozilla LDAP SDK for Java to perform internal operations
+ * in OpenDS.
+ */
+ public Socket makeSocket(String host, int port)
+ {
+ return new InternalLDAPSocket();
+ }
+}
+
--
Gitblit v1.10.0