From 02805157fa504b3dbf701a62280ca9aaf82183b5 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Wed, 05 Sep 2007 20:12:11 +0000
Subject: [PATCH] Partial fix for issue 1449: administration framework aggregation support

---
 opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java b/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
index 4615588..2280700 100644
--- a/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
+++ b/opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
@@ -214,6 +214,91 @@
 
 
 
+  /**
+   * Forcefully removes any resource bundles associated with the
+   * provided definition and using the default locale.
+   * <p>
+   * This method is intended for internal testing only.
+   *
+   * @param d
+   *          The managed object definition.
+   */
+  synchronized void removeResourceBundle(
+      AbstractManagedObjectDefinition<?, ?> d) {
+    removeResourceBundle(d, Locale.getDefault());
+  }
+
+
+
+  /**
+   * Forcefully removes any resource bundles associated with the
+   * provided definition and locale.
+   * <p>
+   * This method is intended for internal testing only.
+   *
+   * @param d
+   *          The managed object definition.
+   * @param locale
+   *          The locale.
+   */
+  synchronized void removeResourceBundle(
+      AbstractManagedObjectDefinition<?, ?> d, Locale locale) {
+    // Get the locale resource mapping.
+    Map<Locale, ResourceBundle> map = resources.get(d);
+    if (map != null) {
+      map.remove(locale);
+    }
+  }
+
+
+
+  /**
+   * Forcefully adds the provided resource bundle to this I18N
+   * resource for the default locale.
+   * <p>
+   * This method is intended for internal testing only.
+   *
+   * @param d
+   *          The managed object definition.
+   * @param resoureBundle
+   *          The resource bundle to be used.
+   */
+  synchronized void setResourceBundle(AbstractManagedObjectDefinition<?, ?> d,
+      ResourceBundle resoureBundle) {
+    setResourceBundle(d, Locale.getDefault(), resoureBundle);
+  }
+
+
+
+  /**
+   * Forcefully adds the provided resource bundle to this I18N
+   * resource.
+   * <p>
+   * This method is intended for internal testing only.
+   *
+   * @param d
+   *          The managed object definition.
+   * @param locale
+   *          The locale.
+   * @param resoureBundle
+   *          The resource bundle to be used.
+   */
+  synchronized void setResourceBundle(AbstractManagedObjectDefinition<?, ?> d,
+      Locale locale, ResourceBundle resoureBundle) {
+    // First get the locale-resource mapping, creating it if
+    // necessary.
+    Map<Locale, ResourceBundle> map = resources.get(d);
+    if (map == null) {
+      map = new HashMap<Locale, ResourceBundle>();
+      resources.put(d, map);
+    }
+
+    // Add the resource bundle.
+    map.put(locale, resoureBundle);
+  }
+
+
+
   // Retrieve the resource bundle associated with a managed object and
   // locale, lazily loading it if necessary.
   private synchronized ResourceBundle getResourceBundle(

--
Gitblit v1.10.0