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/Config.java | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/Config.java b/opends/src/server/org/opends/server/backends/jeb/Config.java
index 021afde..e8e0417 100644
--- a/opends/src/server/org/opends/server/backends/jeb/Config.java
+++ b/opends/src/server/org/opends/server/backends/jeb/Config.java
@@ -34,6 +34,7 @@
MSGID_CONFIG_BACKEND_NO_DIRECTORY;
import static org.opends.server.messages.JebMessages.*;
import static org.opends.server.loggers.Error.logError;
+import static org.opends.server.util.ServerConstants.*;
import org.opends.server.config.BooleanConfigAttribute;
import org.opends.server.config.ConfigConstants;
@@ -203,17 +204,28 @@
static
{
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));
timeUnits = new HashMap<String, Double>();
- timeUnits.put("ms", 1D);
- timeUnits.put("s", 1000D);
- timeUnits.put("m", 60*1000D);
+ timeUnits.put(TIME_UNIT_MILLISECONDS_ABBR, 1D);
+ timeUnits.put(TIME_UNIT_MILLISECONDS_FULL, 1D);
+ timeUnits.put(TIME_UNIT_SECONDS_ABBR, 1000D);
+ timeUnits.put(TIME_UNIT_SECONDS_FULL, 1000D);
+ timeUnits.put(TIME_UNIT_MINUTES_ABBR, (double) (60 * 1000));
+ timeUnits.put(TIME_UNIT_MINUTES_FULL, (double) (60 * 1000));
}
/**
--
Gitblit v1.10.0