From 0a2e22293f5c36807d89441f9bd8c56ae0b59097 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 16 Nov 2007 16:40:35 +0000
Subject: [PATCH] Update admin framework and dsconfig to support tagging of component definitions as advanced and customizable:

---
 opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java |   41 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 38 insertions(+), 3 deletions(-)

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 b533045..193a2ba 100644
--- a/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
+++ b/opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
@@ -42,6 +42,7 @@
 import org.opends.server.admin.InstantiableRelationDefinition;
 import org.opends.server.admin.ManagedObjectDefinition;
 import org.opends.server.admin.ManagedObjectNotFoundException;
+import org.opends.server.admin.ManagedObjectOption;
 import org.opends.server.admin.ManagedObjectPath;
 import org.opends.server.admin.OptionalRelationDefinition;
 import org.opends.server.admin.PropertyDefinition;
@@ -322,6 +323,20 @@
     if (app.isScriptFriendly()) {
       // Output just the names of the children.
       for (String name : children.keySet()) {
+        // Skip advanced and hidden components in non-advanced mode.
+        if (!app.isAdvancedMode()) {
+          ManagedObject<?> child = children.get(name);
+          ManagedObjectDefinition<?, ?> d = child.getManagedObjectDefinition();
+
+          if (d.hasOption(ManagedObjectOption.HIDDEN)) {
+            continue;
+          }
+
+          if (d.hasOption(ManagedObjectOption.ADVANCED)) {
+            continue;
+          }
+        }
+
         app.println(Message.raw(name));
       }
     } else {
@@ -341,6 +356,17 @@
         ManagedObject<?> child = children.get(name);
         ManagedObjectDefinition<?, ?> d = child.getManagedObjectDefinition();
 
+        // Skip advanced and hidden components in non-advanced mode.
+        if (!app.isAdvancedMode()) {
+          if (d.hasOption(ManagedObjectOption.HIDDEN)) {
+            continue;
+          }
+
+          if (d.hasOption(ManagedObjectOption.ADVANCED)) {
+            continue;
+          }
+        }
+
         // First output the name.
         builder.startRow();
         builder.appendCell(name);
@@ -348,11 +374,20 @@
         // 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)) {
-          builder.appendCell("generic");
+          if (isCustom) {
+            builder.appendCell(DSConfig.CUSTOM_TYPE);
+          } else {
+            builder.appendCell(DSConfig.GENERIC_TYPE);
+          }
         } else if (childType.endsWith(typeSuffix)) {
-          builder.appendCell(childType.substring(0, childType.length()
-              - typeSuffix.length()));
+          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);
         }

--
Gitblit v1.10.0