From 57dcbf9c69ce5f0bba384b88555b48a5d87d3476 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Mon, 02 Jan 2012 15:58:40 +0000
Subject: [PATCH] Fix OPENDJ-391: Improve List existing Local DB Indexes output in dsconfig

---
 opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml |    4 +++-
 opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java     |   50 ++++++++++++++++++++++++++++++--------------------
 2 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml
index 4d61c59..56cd066 100644
--- a/opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml
+++ b/opends/src/admin/defn/org/opends/server/admin/std/LocalDBBackendConfiguration.xml
@@ -24,7 +24,7 @@
   !
   !
   !      Copyright 2007-2010 Sun Microsystems, Inc.
-  !      Portions Copyright 2010-2011 ForgeRock AS.
+  !      Portions Copyright 2010-2012 ForgeRock AS.
   ! -->
 <adm:managed-object name="local-db-backend"
   plural-name="local-db-backends" package="org.opends.server.admin.std"
@@ -100,6 +100,8 @@
     <adm:profile name="cli">
       <cli:relation>
         <cli:default-property name="index-type" />
+        <cli:default-property name="index-entry-limit" />
+        <cli:default-property name="index-extensible-matching-rule" />
       </cli:relation>
     </adm:profile>
   </adm:relation>
diff --git a/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java b/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
index 032ea9c..c60a7ff 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
@@ -22,6 +22,7 @@
  * CDDL HEADER END
  *
  *      Copyright 2008-2009 Sun Microsystems, Inc.
+ *      Portions copyright 2012 ForgeRock AS.
  */
 package org.opends.server.tools.dsconfig;
 
@@ -418,11 +419,18 @@
         app.println(Message.raw(name));
       }
     } else {
-      // Create a table of their properties.
+      // Create a table of their properties containing the name, type (if
+      // appropriate), and requested properties.
+      SortedMap<String, ?> subTypes =
+          getSubTypes(relation.getChildDefinition());
+      boolean includeTypesColumn = (subTypes.size() != 1
+          || !subTypes.containsKey(DSConfig.GENERIC_TYPE));
+
       TableBuilder builder = new TableBuilder();
       builder.appendHeading(relation.getUserFriendlyName());
-      builder
-          .appendHeading(INFO_DSCFG_HEADING_COMPONENT_TYPE.get());
+      if (includeTypesColumn) {
+        builder.appendHeading(INFO_DSCFG_HEADING_COMPONENT_TYPE.get());
+      }
       for (String propertyName : propertyNames) {
         builder.appendHeading(Message.raw(propertyName));
       }
@@ -453,25 +461,27 @@
           builder.appendCell(name);
         }
 
-        // Output the managed object type in the form used in
-        // create-xxx commands.
-        String childType = d.getName();
-        boolean isCustom = CLIProfile.getInstance().isForCustomization(d);
-        if (baseType.equals(childType)) {
-          if (isCustom) {
-            builder.appendCell(DSConfig.CUSTOM_TYPE);
+        if (includeTypesColumn) {
+          // Output the managed object type in the form used in
+          // create-xxx commands.
+          String childType = d.getName();
+          boolean isCustom = CLIProfile.getInstance().isForCustomization(d);
+          if (baseType.equals(childType)) {
+            if (isCustom) {
+              builder.appendCell(DSConfig.CUSTOM_TYPE);
+            } else {
+              builder.appendCell(DSConfig.GENERIC_TYPE);
+            }
+          } else if (childType.endsWith(typeSuffix)) {
+            String ctname = childType.substring(0, childType.length()
+                - typeSuffix.length());
+            if (isCustom) {
+              ctname = String.format("%s-%s", DSConfig.CUSTOM_TYPE, ctname);
+            }
+            builder.appendCell(ctname);
           } else {
-            builder.appendCell(DSConfig.GENERIC_TYPE);
+            builder.appendCell(childType);
           }
-        } else if (childType.endsWith(typeSuffix)) {
-          String ctname = childType.substring(0, childType.length()
-              - typeSuffix.length());
-          if (isCustom) {
-            ctname = String.format("%s-%s", DSConfig.CUSTOM_TYPE, ctname);
-          }
-          builder.appendCell(ctname);
-        } else {
-          builder.appendCell(childType);
         }
 
         // Now any requested properties.

--
Gitblit v1.10.0