From 6fa0b021682d98ef9f908dfa248985a8507c6fa0 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 17 Sep 2007 15:43:08 +0000
Subject: [PATCH] Implement a new configuration definition called "TopCfgDefn" which acts as the parent of all other configuration definitions. This is analogous to the the "top" object class in LDAP.

---
 opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java b/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java
index c3e4a20..6974cd3 100644
--- a/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java
+++ b/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionResource.java
@@ -42,6 +42,8 @@
 /**
  * A class for retrieving non-internationalized resource properties
  * associated with a managed object definition.
+ * <p>
+ * Resource properties are not available for the {@link TopCfgDefn}.
  */
 public final class ManagedObjectDefinitionResource {
 
@@ -89,9 +91,18 @@
    *         key.
    * @throws MissingResourceException
    *           If the key was not found.
+   * @throws UnsupportedOperationException
+   *           If the provided managed object definition was the
+   *           {@link TopCfgDefn}.
    */
-  public String getString(AbstractManagedObjectDefinition<?, ?> d,
-      String key) throws MissingResourceException {
+  public String getString(AbstractManagedObjectDefinition<?, ?> d, String key)
+      throws MissingResourceException, UnsupportedOperationException {
+    if (d.isTop()) {
+      throw new UnsupportedOperationException(
+          "Profile resources are not available for the "
+              + "Top configuration definition");
+    }
+
     Properties p = getProperties(d);
     String result = p.getProperty(key);
 
@@ -109,8 +120,7 @@
 
 
   // Retrieve the properties table associated with a managed object,
-  // lazily
-  // loading it if necessary.
+  // lazily loading it if necessary.
   private synchronized Properties getProperties(
       AbstractManagedObjectDefinition<?, ?> d)
       throws MissingResourceException {

--
Gitblit v1.10.0