From 95df5cfdba474acb03076953e992b898fbb277a8 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.

---
 opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java b/opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java
index fa9d2d1..8fbb0b6 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/CLIProfile.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2009 Sun Microsystems, Inc.
  */
 
 package org.opends.server.tools.dsconfig;
@@ -30,13 +30,14 @@
 
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.opends.server.admin.AbstractManagedObjectDefinition;
-import org.opends.server.admin.InstantiableRelationDefinition;
 import org.opends.server.admin.ManagedObjectDefinitionResource;
 import org.opends.server.admin.RelationDefinition;
+import org.opends.server.admin.SetRelationDefinition;
 
 
 
@@ -83,7 +84,11 @@
   public Set<String> getDefaultListPropertyNames(RelationDefinition<?, ?> r) {
     String s = resource.getString(r.getParentDefinition(), "relation."
         + r.getName() + ".list-properties");
-    return new LinkedHashSet<String>(Arrays.asList(s.split(",")));
+    if (s.trim().length() == 0) {
+      return Collections.emptySet();
+    } else {
+      return new LinkedHashSet<String>(Arrays.asList(s.split(",")));
+    }
   }
 
 
@@ -97,7 +102,7 @@
    * @return Returns the naming argument which should be used for a
    *         relation definition.
    */
-  public String getNamingArgument(InstantiableRelationDefinition<?, ?> r) {
+  public String getNamingArgument(RelationDefinition<?, ?> r) {
     String s = resource.getString(r.getParentDefinition(),
         "relation." + r.getName() + ".naming-argument-override").trim();
 
@@ -112,7 +117,16 @@
       } else {
         builder.append(s.substring(i + 1));
       }
-      builder.append("-name");
+
+      if (r instanceof SetRelationDefinition) {
+        // Set relations are named using their type, so be consistent
+        // with their associated create-xxx sub-command.
+        builder.append("-type");
+      } else {
+        // Other relations (instantiable) are named by the user.
+        builder.append("-name");
+      }
+
       s = builder.toString();
     }
 

--
Gitblit v1.10.0