From 12f788c17b8c281179f0819352f02b612b0219e2 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 02 Feb 2009 23:37:54 +0000
Subject: [PATCH] Fix issue 3734 - Make network group policies extensible.

---
 opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java |   67 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
index f5422e8..027b896 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/admin/LDAPProfile.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.server.admin;
@@ -104,7 +104,7 @@
      *         the instantiable relation is not handled by this LDAP
      *         profile wrapper.
      */
-    public String getInstantiableRelationChildRDNType(
+    public String getRelationChildRDNType(
         InstantiableRelationDefinition<?, ?> r) {
       return null;
     }
@@ -112,6 +112,26 @@
 
 
     /**
+     * Gets the LDAP RDN attribute type for child entries of an set
+     * relation.
+     * <p>
+     * The default implementation of this method is to return
+     * <code>null</code>.
+     *
+     * @param r
+     *          The set relation.
+     * @return Returns the LDAP RDN attribute type for child entries of
+     *         an set relation, or <code>null</code> if the set relation
+     *         is not handled by this LDAP profile wrapper.
+     */
+    public String getRelationChildRDNType(SetRelationDefinition<?, ?> r)
+    {
+      return null;
+    }
+
+
+
+    /**
      * Get the principle object class associated with the specified
      * definition.
      * <p>
@@ -217,7 +237,7 @@
    *           If the LDAP profile properties file associated with the
    *           provided managed object definition could not be loaded.
    */
-  public String getInstantiableRelationChildRDNType(
+  public String getRelationChildRDNType(
       InstantiableRelationDefinition<?, ?> r) throws MissingResourceException {
     if (r.getNamingPropertyDefinition() != null) {
       // Use the attribute associated with the naming property.
@@ -225,7 +245,7 @@
           .getNamingPropertyDefinition());
     } else {
       for (Wrapper profile : profiles) {
-        String rdnType = profile.getInstantiableRelationChildRDNType(r);
+        String rdnType = profile.getRelationChildRDNType(r);
         if (rdnType != null) {
           return rdnType;
         }
@@ -238,23 +258,52 @@
 
 
   /**
-   * Gets the LDAP object classes associated with an instantiable
+   * Gets the LDAP object classes associated with an instantiable or set
    * relation branch. The branch is the parent entry of child managed
    * objects.
    *
    * @param r
-   *          The instantiable relation.
+   *          The instantiable or set relation.
    * @return Returns the LDAP object classes associated with an
-   *         instantiable relation branch.
+   *         instantiable or set relation branch.
    */
-  public List<String> getInstantiableRelationObjectClasses(
-      InstantiableRelationDefinition<?, ?> r) {
+  public List<String> getRelationObjectClasses(
+      RelationDefinition<?, ?> r) {
     return Arrays.asList(new String[] { "top", "ds-cfg-branch" });
   }
 
 
 
   /**
+   * Gets the LDAP RDN attribute type for child entries of an set
+   * relation.
+   *
+   * @param r
+   *          The set relation.
+   * @return Returns the LDAP RDN attribute type for child entries of an
+   *         set relation.
+   * @throws MissingResourceException
+   *           If the LDAP profile properties file associated with the
+   *           provided managed object definition could not be loaded.
+   */
+  public String getRelationChildRDNType(SetRelationDefinition<?, ?> r)
+      throws MissingResourceException
+  {
+    for (Wrapper profile : profiles)
+    {
+      String rdnType = profile.getRelationChildRDNType(r);
+      if (rdnType != null)
+      {
+        return rdnType;
+      }
+    }
+    return resource.getString(r.getParentDefinition(),
+        "naming-attribute." + r.getName());
+  }
+
+
+
+  /**
    * Get the principle object class associated with the specified
    * definition.
    *

--
Gitblit v1.10.0