From 461b1f6784e6cf1483dc29fdcbef14ccfe6bc849 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 04 Aug 2006 23:17:58 +0000
Subject: [PATCH] Update the configuration and the associated code to be more consistent in the time and size units used for various purposes.  A new set of constants have been added to allow the same units to be used throughout the code, including providing both full and abbreviated unit names.

---
 opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java b/opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java
index ea4587c..66c1d12 100644
--- a/opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java
+++ b/opends/src/server/org/opends/server/backends/jeb/ConfigurableEnvironment.java
@@ -52,6 +52,7 @@
 
 import static org.opends.server.messages.MessageHandler.getMessage;
 import static org.opends.server.messages.JebMessages.*;
+import static org.opends.server.util.ServerConstants.*;
 
 /**
  * This class represents a JE environment handle that can be configured by the
@@ -224,19 +225,31 @@
   static
   {
     HashMap<String, Double> memoryUnits = new HashMap<String, Double>();
-    memoryUnits.put("KB", 1000D);
-    memoryUnits.put("MB", 1000000D);
-    memoryUnits.put("GB", 1000000000D);
-    memoryUnits.put("KiB", 1024D);                 // kibibyte
-    memoryUnits.put("MiB", 1024D * 1024D);         // mebibyte
-    memoryUnits.put("GiB", 1024D * 1024D * 1024D); // gibibyte
+    memoryUnits.put(SIZE_UNIT_BYTES_ABBR, 1D);
+    memoryUnits.put(SIZE_UNIT_BYTES_FULL, 1D);
+    memoryUnits.put(SIZE_UNIT_KILOBYTES_ABBR, 1000D);
+    memoryUnits.put(SIZE_UNIT_KILOBYTES_FULL, 1000D);
+    memoryUnits.put(SIZE_UNIT_MEGABYTES_ABBR, 1000000D);
+    memoryUnits.put(SIZE_UNIT_MEGABYTES_FULL, 1000000D);
+    memoryUnits.put(SIZE_UNIT_GIGABYTES_ABBR, 1000000000D);
+    memoryUnits.put(SIZE_UNIT_GIGABYTES_FULL, 1000000000D);
+    memoryUnits.put(SIZE_UNIT_KIBIBYTES_ABBR, 1024D);
+    memoryUnits.put(SIZE_UNIT_KIBIBYTES_FULL, 1024D);
+    memoryUnits.put(SIZE_UNIT_MEBIBYTES_ABBR, (double) (1024 * 1024));
+    memoryUnits.put(SIZE_UNIT_MEBIBYTES_FULL, (double) (1024 * 1024));
+    memoryUnits.put(SIZE_UNIT_GIBIBYTES_ABBR, (double) (1024 * 1024 * 1024));
+    memoryUnits.put(SIZE_UNIT_GIBIBYTES_FULL, (double) (1024 * 1024 * 1024));
 
     // JE time intervals are expressed in microseconds.
     HashMap<String, Double> timeUnits = new HashMap<String, Double>();
-    timeUnits.put("us", 1D);
-    timeUnits.put("ms", 1000D);
-    timeUnits.put("s",  1000000D);
-    timeUnits.put("m",  60*1000000D);
+    timeUnits.put(TIME_UNIT_MICROSECONDS_ABBR, 1D);
+    timeUnits.put(TIME_UNIT_MICROSECONDS_FULL, 1D);
+    timeUnits.put(TIME_UNIT_MILLISECONDS_ABBR, 1000D);
+    timeUnits.put(TIME_UNIT_MILLISECONDS_FULL, 1000D);
+    timeUnits.put(TIME_UNIT_SECONDS_ABBR, 1000000D);
+    timeUnits.put(TIME_UNIT_SECONDS_FULL, 1000000D);
+    timeUnits.put(TIME_UNIT_MINUTES_ABBR, (double) (60 * 1000000));
+    timeUnits.put(TIME_UNIT_MINUTES_FULL, (double) (60 * 1000000));
 
     String msg;
 

--
Gitblit v1.10.0