From 81d36161ce5367fa7aa9a5d99dc8b80eacfa7cdf Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 24 Jan 2014 14:43:46 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1288 : Migrate I18n and logging support to i18n framework and SLF4J
---
opendj3-server-dev/src/server/org/opends/server/api/ErrorLogPublisher.java | 52 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/ErrorLogPublisher.java b/opendj3-server-dev/src/server/org/opends/server/api/ErrorLogPublisher.java
index f876cb6..63db1bc 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/ErrorLogPublisher.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/ErrorLogPublisher.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS
+ * Portions Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.api;
@@ -32,8 +32,7 @@
import java.util.Map;
import java.util.Set;
-import org.opends.messages.Category;
-import org.opends.messages.Message;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.messages.Severity;
import org.opends.server.admin.std.server.ErrorLogPublisherCfg;
@@ -56,8 +55,8 @@
* The hash map that will be used to define specific log severities
* for the various categories.
*/
- protected Map<Category, Set<Severity>> definedSeverities =
- new HashMap<Category, Set<Severity>>();
+ protected Map<String, Set<Severity>> definedSeverities =
+ new HashMap<String, Set<Severity>>();
@@ -72,7 +71,7 @@
/** {@inheritDoc} */
@Override
public boolean isConfigurationAcceptable(T configuration,
- List<Message> unacceptableReasons)
+ List<LocalizableMessage> unacceptableReasons)
{
// This default implementation does not perform any special
// validation. It should be overridden by error log publisher
@@ -80,15 +79,46 @@
return true;
}
-
+ /**
+ * Writes a message to the error log using the provided information. The
+ * message's category and severity information will be used to determine
+ * whether to actually log this message.
+ *
+ * @param message
+ * The message to be logged.
+ */
+ public void logError(LocalizableMessage message) {
+ // TODO : to remove
+ }
/**
* Writes a message to the error log using the provided information.
- * The message's category and severity information will be used to
- * determine whether to actually log this message.
+ * <p>
+ * The category and severity information are used to determine whether to
+ * actually log this message.
*
- * @param message The message to be logged.
+ * @param category
+ * The category of the message.
+ * @param severity
+ * The severity of the message.
+ * @param message
+ * The message to be logged.
+ * @param exception
+ * The exception to be logged.
*/
- public abstract void logError(Message message);
+ public abstract void log(String category, Severity severity,
+ LocalizableMessage message, Throwable exception);
+
+ /**
+ * Check if a message should be logged for the provided category and severity.
+ *
+ * @param category
+ * The category of the message.
+ * @param severity
+ * The severity of the message.
+ * @return {@code true} if the message should be logged, {@code false}
+ * otherwise
+ */
+ public abstract boolean isEnabledFor(String category, Severity severity);
}
--
Gitblit v1.10.0