From 4bfbd4ec8f38d5bd1db1355965588f234a6a620d Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 22 Feb 2013 09:38:34 +0000
Subject: [PATCH] Fix DL url

---
 opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetPerfStats.java |  170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 opendj3/opendj-ldap-toolkit/src/site/site.xml                                                  |    2 
 opendj3/opendj-ldap-sdk/src/site/site.xml                                                      |    2 
 opendj3/opendj-ldap-sdk-examples/src/site/site.xml                                             |    2 
 opendj3/src/site/site.xml                                                                      |    2 
 5 files changed, 174 insertions(+), 4 deletions(-)

diff --git a/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetPerfStats.java b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetPerfStats.java
new file mode 100644
index 0000000..94bbc3e
--- /dev/null
+++ b/opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/GetPerfStats.java
@@ -0,0 +1,170 @@
+/*
+ * 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/opendj3/legal-notices/CDDLv1_0.txt
+ * or http://forgerock.org/license/CDDLv1.0.html.
+ * 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/opendj3/legal-notices/CDDLv1_0.txt.  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
+ *
+ *
+ *      Copyright 2012 ForgeRock AS
+ */
+package org.forgerock.opendj.examples;
+
+
+
+import java.io.IOException;
+
+import org.forgerock.opendj.ldap.*;
+import org.forgerock.opendj.ldap.responses.SearchResultEntry;
+import org.forgerock.opendj.ldif.LDIFEntryWriter;
+
+
+
+/**
+ * Demonstrates accessing server information about capabilities and schema.
+ */
+public final class GetPerfStats
+{
+  // Connection information
+  private static String host;
+  private static int port;
+  // The kind of server information to request (all, controls, extops)
+  private static String infoType;
+
+
+
+  /**
+   * Access the directory over LDAP to request information about capabilities
+   * and schema.
+   *
+   * @param args
+   *          The command line arguments
+   */
+  public static void main(final String[] args)
+  {
+    parseArgs(args);
+    connect();
+  }
+
+
+
+  /**
+   * Authenticate over LDAP.
+   */
+  private static void connect()
+  {
+    final LDAPConnectionFactory factory = new LDAPConnectionFactory(host, port);
+    Connection connection = null;
+
+    try
+    {
+      connection = factory.getConnection();
+      connection.bind("", "".toCharArray()); // Anonymous bind
+
+      final String attributeList;
+      if (infoType.toLowerCase().equals("controls"))
+      {
+        attributeList = "supportedControl";
+      }
+      else if (infoType.toLowerCase().equals("extops"))
+      {
+        attributeList = "supportedExtension";
+      }
+      else
+      {
+        attributeList = "+"; // All operational attributes
+      }
+
+      final SearchResultEntry entry = connection.searchSingleEntry(
+          "",                      // DN is "" for root DSE.
+          SearchScope.BASE_OBJECT, // Read only the root DSE.
+          "objectclass=*",         // Every object matches this filter.
+          attributeList);          // Return these requested attributes.
+
+      final LDIFEntryWriter writer = new LDIFEntryWriter(System.out);
+      writer.writeComment("Root DSE for LDAP server at " + host + ":" + port);
+      if (entry != null)
+      {
+        writer.writeEntry(entry);
+      }
+      writer.flush();
+    }
+    catch (final ErrorResultException e)
+    {
+      System.err.println(e.getMessage());
+      System.exit(e.getResult().getResultCode().intValue());
+    }
+    catch (final IOException e)
+    {
+      System.err.println(e.getMessage());
+      System.exit(ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue());
+    }
+    finally
+    {
+      if (connection != null)
+      {
+        connection.close();
+      }
+    }
+  }
+
+
+
+  private static void giveUp()
+  {
+    printUsage();
+    System.exit(1);
+  }
+
+
+
+  /**
+   * Parse command line arguments.
+   *
+   * @param args
+   *          host port bind-dn bind-password info-type
+   */
+  private static void parseArgs(final String[] args)
+  {
+    if (args.length != 3)
+    {
+      giveUp();
+    }
+
+    host = args[0];
+    port = Integer.parseInt(args[1]);
+    infoType = args[2]; // all, controls, or extops
+    if (!(infoType.toLowerCase().equals("all")
+        || infoType.toLowerCase().equals("controls")
+        || infoType.toLowerCase().equals("extops")))
+    {
+      giveUp();
+    }
+  }
+
+
+
+  private static void printUsage()
+  {
+    System.err.println("Usage: host port info-type");
+    System.err.println("\tAll arguments are required.");
+    System.err
+        .println("\tinfo-type to get can be either all, controls, or extops.");
+  }
+}
diff --git a/opendj3/opendj-ldap-sdk-examples/src/site/site.xml b/opendj3/opendj-ldap-sdk-examples/src/site/site.xml
index 5eeba66..f1b4a5e 100644
--- a/opendj3/opendj-ldap-sdk-examples/src/site/site.xml
+++ b/opendj3/opendj-ldap-sdk-examples/src/site/site.xml
@@ -38,7 +38,7 @@
       <item name="Partners" href="http://forgerock.com/partners/" />
       <item name="Builds" href="http://forgerock.org/opendj.html" />
       <item name="Archives" href="http://forgerock.org/opendj-archive.html" />
-      <item name="Enterprise Downloads" href="http://forgerock.com/opendj-downloads/"/>
+      <item name="Enterprise Downloads" href="http://www.forgerock.com/download-stack/"/>
     </menu>
 
     <menu name="OpenDJ Directory Server">
diff --git a/opendj3/opendj-ldap-sdk/src/site/site.xml b/opendj3/opendj-ldap-sdk/src/site/site.xml
index 10c2415..55be45a 100644
--- a/opendj3/opendj-ldap-sdk/src/site/site.xml
+++ b/opendj3/opendj-ldap-sdk/src/site/site.xml
@@ -38,7 +38,7 @@
       <item name="Partners" href="http://forgerock.com/partners/" />
       <item name="Builds" href="http://forgerock.org/opendj.html" />
       <item name="Archives" href="http://forgerock.org/opendj-archive.html" />
-      <item name="Enterprise Downloads" href="http://forgerock.com/opendj-downloads/"/>
+      <item name="Enterprise Downloads" href="http://www.forgerock.com/download-stack/"/>
     </menu>
 
     <menu name="OpenDJ Directory Server">
diff --git a/opendj3/opendj-ldap-toolkit/src/site/site.xml b/opendj3/opendj-ldap-toolkit/src/site/site.xml
index 9b976da..cd006c3 100644
--- a/opendj3/opendj-ldap-toolkit/src/site/site.xml
+++ b/opendj3/opendj-ldap-toolkit/src/site/site.xml
@@ -38,7 +38,7 @@
       <item name="Partners" href="http://forgerock.com/partners/" />
       <item name="Builds" href="http://forgerock.org/opendj.html" />
       <item name="Archives" href="http://forgerock.org/opendj-archive.html" />
-      <item name="Enterprise Downloads" href="http://forgerock.com/opendj-downloads/"/>
+      <item name="Enterprise Downloads" href="http://www.forgerock.com/download-stack/"/>
     </menu>
 
     <menu name="OpenDJ Directory Server">
diff --git a/opendj3/src/site/site.xml b/opendj3/src/site/site.xml
index 5850071..379f276 100644
--- a/opendj3/src/site/site.xml
+++ b/opendj3/src/site/site.xml
@@ -54,7 +54,7 @@
    <item name="Partners" href="http://forgerock.com/partners/" />
    <item name="Builds" href="http://forgerock.org/opendj.html" />
    <item name="Archives" href="http://forgerock.org/opendj-archive.html" />
-   <item name="Enterprise Downloads" href="http://forgerock.com/opendj-downloads/"/>
+   <item name="Enterprise Downloads" href="http://www.forgerock.com/download-stack/"/>
   </menu>
 
   <menu name="OpenDJ Directory Server">

--
Gitblit v1.10.0