From 9dc10dec2d5d7f61116f7f647b7cf9596ca77be0 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 05 Jun 2009 09:04:50 +0000
Subject: [PATCH] svn merge -r5333:5417 https://opends.dev.java.net/svn/opends/branches/b2.0
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 6b89631..5dcca22 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -83,6 +83,13 @@
}
/**
+ * The class name that contains the control panel customizations for
+ * products.
+ */
+ private final static String CUSTOMIZATION_CLASS_NAME =
+ "org.opends.server.util.ReleaseDefinition";
+
+ /**
* Enumeration that specify if the operation applies to the install directory
* only, to the instance directory only, or both.
*/
@@ -1747,6 +1754,37 @@
}
return buffer.toString();
}
+
+ /**
+ * Tries to find a customized message in the customization class. If the
+ * customization class does not exist or it does not contain the field
+ * as a message, returns the default message.
+ * @param <T> the type of the customized object.
+ * @param fieldName the name of the field representing a message in the
+ * customization class.
+ * @param defaultValue the default value.
+ * @param valueClass the class of the parametrized value.
+ * @return the customized message.
+ */
+ public static <T> T getCustomizedObject(String fieldName,
+ T defaultValue, Class<T> valueClass)
+ {
+ T value = defaultValue;
+ if (!isWebStart())
+ {
+ try
+ {
+ Class c = Class.forName(Utils.CUSTOMIZATION_CLASS_NAME);
+ Object obj = c.newInstance();
+
+ value = valueClass.cast(c.getField(fieldName).get(obj));
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ return value;
+ }
}
/**
--
Gitblit v1.10.0