From e538344449d345daa6e5ecb9b05ceba5427408e9 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Wed, 04 Dec 2013 14:13:59 +0000
Subject: [PATCH] OpenDJ 3 : config framework

---
 opendj-admin/src/main/java/org/opends/server/admin/server/DNBuilder.java |   79 +++++++++++++++------------------------
 1 files changed, 31 insertions(+), 48 deletions(-)

diff --git a/opendj-admin/src/main/java/org/opends/server/admin/server/DNBuilder.java b/opendj-admin/src/main/java/org/opends/server/admin/server/DNBuilder.java
index b3c25c6..f7c4448 100644
--- a/opendj-admin/src/main/java/org/opends/server/admin/server/DNBuilder.java
+++ b/opendj-admin/src/main/java/org/opends/server/admin/server/DNBuilder.java
@@ -27,64 +27,47 @@
 
 package org.opends.server.admin.server;
 
-
-
 import org.forgerock.opendj.ldap.DN;
 import org.opends.server.admin.LDAPProfile;
 import org.opends.server.admin.ManagedObjectPath;
 import org.opends.server.admin.RelationDefinition;
-import org.opends.server.types.DirectoryException;
-
-
 
 /**
- * A factory class for creating <code>DN</code>s from managed
- * object paths.
+ * A factory class for creating <code>DN</code>s from managed object paths.
  */
 final class DNBuilder {
 
-  /**
-   * Creates a new DN representing the specified managed object path.
-   *
-   * @param path
-   *          The managed object path.
-   * @return Returns a new DN representing the specified managed
-   *         object path.
-   */
-  public static DN create(ManagedObjectPath<?, ?> path) {
-    return path.toDN();
-  }
-
-
-
-  /**
-   * Creates a new DN representing the specified managed object path
-   * and relation.
-   *
-   * @param path
-   *          The managed object path.
-   * @param relation
-   *          The child relation.
-   * @return Returns a new DN representing the specified managed
-   *         object path and relation.
-   */
-  public static DN create(ManagedObjectPath<?, ?> path,
-      RelationDefinition<?, ?> relation) {
-    DN dn = path.toDN();
-
-    try {
-      LDAPProfile profile = LDAPProfile.getInstance();
-      DN localName = DN.decode(profile.getRelationRDNSequence(relation));
-      return dn.concat(localName);
-    } catch (DirectoryException e) {
-      throw new RuntimeException(e);
+    /**
+     * Creates a new DN representing the specified managed object path.
+     *
+     * @param path
+     *            The managed object path.
+     * @return Returns a new DN representing the specified managed object path.
+     */
+    public static DN create(ManagedObjectPath<?, ?> path) {
+        return path.toDN();
     }
-  }
 
+    /**
+     * Creates a new DN representing the specified managed object path and
+     * relation.
+     *
+     * @param path
+     *            The managed object path.
+     * @param relation
+     *            The child relation.
+     * @return Returns a new DN representing the specified managed object path
+     *         and relation.
+     */
+    public static DN create(ManagedObjectPath<?, ?> path, RelationDefinition<?, ?> relation) {
+        DN dn = path.toDN();
+        LDAPProfile profile = LDAPProfile.getInstance();
+        DN localName = DN.valueOf(profile.getRelationRDNSequence(relation));
+        return dn.child(localName);
+    }
 
-
-  // Prevent instantiation.
-  private DNBuilder() {
-    // No implementation required.
-  }
+    // Prevent instantiation.
+    private DNBuilder() {
+        // No implementation required.
+    }
 }

--
Gitblit v1.10.0