summaryrefslogtreecommitdiffstats
path: root/base/common/src
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-06-21 18:46:57 +0200
committerEndi S. Dewata <edewata@redhat.com>2017-06-22 04:00:37 +0200
commitd884229da2673703777d474fddd8c3c61eba9308 (patch)
treee442aa8a5e652fe4a0ec5cc6ba13e6052bc908d3 /base/common/src
parentb4c50042b821f9bca854be2fbea382738060764d (diff)
downloadpki-d884229da2673703777d474fddd8c3c61eba9308.tar.gz
pki-d884229da2673703777d474fddd8c3c61eba9308.tar.xz
pki-d884229da2673703777d474fddd8c3c61eba9308.zip
Added LogCategory enumeration.
A LogCategory enumeration has been added to replace the integer log category in the Logger class. https://pagure.io/dogtagpki/issue/2689 Change-Id: Ic92e64c3abdf859841eaf1006afc61bbf573086d
Diffstat (limited to 'base/common/src')
-rw-r--r--base/common/src/com/netscape/certsrv/logging/ILogEventFactory.java2
-rw-r--r--base/common/src/com/netscape/certsrv/logging/ILogger.java44
-rw-r--r--base/common/src/com/netscape/certsrv/logging/LogCategory.java24
-rw-r--r--base/common/src/com/netscape/certsrv/ocsp/IOCSPAuthority.java7
4 files changed, 51 insertions, 26 deletions
diff --git a/base/common/src/com/netscape/certsrv/logging/ILogEventFactory.java b/base/common/src/com/netscape/certsrv/logging/ILogEventFactory.java
index ea61d0f2f..1cc48a502 100644
--- a/base/common/src/com/netscape/certsrv/logging/ILogEventFactory.java
+++ b/base/common/src/com/netscape/certsrv/logging/ILogEventFactory.java
@@ -40,7 +40,7 @@ public interface ILogEventFactory {
* @param params The parameters in the detail log message.
* @return The created ILogEvent object.
*/
- public ILogEvent create(int evtClass, Properties prop, int source,
+ public ILogEvent create(LogCategory evtClass, Properties prop, int source,
int level, boolean multiline, String msg, Object params[]);
/**
diff --git a/base/common/src/com/netscape/certsrv/logging/ILogger.java b/base/common/src/com/netscape/certsrv/logging/ILogger.java
index c036a538b..633f668b8 100644
--- a/base/common/src/com/netscape/certsrv/logging/ILogger.java
+++ b/base/common/src/com/netscape/certsrv/logging/ILogger.java
@@ -35,20 +35,20 @@ public interface ILogger {
/**
* log class: audit event.
*/
- public static final int EV_AUDIT = 0;
+ public static final LogCategory EV_AUDIT = LogCategory.TRANSACTION;
public static final String PROP_AUDIT = "transaction";
/**
* log class: system event.
* System event with log level >= LL_FAILURE will also be logged in error log
*/
- public static final int EV_SYSTEM = 1;
+ public static final LogCategory EV_SYSTEM = LogCategory.SYSTEM;
public static final String PROP_SYSTEM = "system";
/**
* log class: SignedAudit event.
*/
- public static final int EV_SIGNED_AUDIT = 2;
+ public static final LogCategory EV_SIGNED_AUDIT = LogCategory.SIGNED_AUDIT;
public static final String PROP_SIGNED_AUDIT = "signedAudit";
//List of defined log sources.
@@ -275,7 +275,7 @@ public interface ILogger {
* @param source The source of the log event.
* @param msg The detail message to be logged.
*/
- public void log(int evtClass, int source, String msg);
+ public void log(LogCategory evtClass, int source, String msg);
/**
* Logs an event to the log queue.
@@ -285,7 +285,7 @@ public interface ILogger {
* @param source The source of the log event.
* @param msg The detail message to be logged.
*/
- public void log(int evtClass, Properties props, int source, String msg);
+ public void log(LogCategory evtClass, Properties props, int source, String msg);
/**
* Logs an event to the log queue.
@@ -295,7 +295,7 @@ public interface ILogger {
* @param level The level of the log event.
* @param msg The detail message to be logged.
*/
- public void log(int evtClass, int source, int level, String msg);
+ public void log(LogCategory evtClass, int source, int level, String msg);
/**
* Logs an event to the log queue.
@@ -306,7 +306,7 @@ public interface ILogger {
* @param level The level of the log event.
* @param msg The detail message to be logged.
*/
- public void log(int evtClass, Properties props, int source, int level, String msg);
+ public void log(LogCategory evtClass, Properties props, int source, int level, String msg);
/**
* Logs an event to the log queue.
@@ -317,7 +317,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param param The parameter in the detail message.
*/
- public void log(int evtClass, int source, int level, String msg, Object param);
+ public void log(LogCategory evtClass, int source, int level, String msg, Object param);
/**
* Logs an event to the log queue.
@@ -328,7 +328,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param params The parameters in the detail message.
*/
- public void log(int evtClass, int source, int level, String msg, Object params[]);
+ public void log(LogCategory evtClass, int source, int level, String msg, Object params[]);
/**
* Logs an event to the log queue.
@@ -339,7 +339,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param param The parameters in the detail message.
*/
- public void log(int evtClass, Properties props, int source, String msg, Object param);
+ public void log(LogCategory evtClass, Properties props, int source, String msg, Object param);
/**
* Logs an event to the log queue.
@@ -351,7 +351,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param param The parameter in the detail message.
*/
- public void log(int evtClass, Properties props, int source, int level, String msg,
+ public void log(LogCategory evtClass, Properties props, int source, int level, String msg,
Object param);
/**
@@ -364,7 +364,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param params The parameters in the detail message.
*/
- public void log(int evtClass, Properties prop, int source, int level, String msg,
+ public void log(LogCategory evtClass, Properties prop, int source, int level, String msg,
Object params[]);
//multiline log
@@ -377,7 +377,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param multiline true If the message has more than one line, otherwise false.
*/
- public void log(int evtClass, int source, String msg, boolean multiline);
+ public void log(LogCategory evtClass, int source, String msg, boolean multiline);
/**
* Logs an event to the log queue.
@@ -388,7 +388,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, Properties props, int source, String msg, boolean multiline);
+ public void log(LogCategory evtClass, Properties props, int source, String msg, boolean multiline);
/**
* Logs an event to the log queue.
@@ -399,7 +399,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, int source, int level, String msg, boolean multiline);
+ public void log(LogCategory evtClass, int source, int level, String msg, boolean multiline);
/**
* Logs an event to the log queue.
@@ -411,7 +411,7 @@ public interface ILogger {
* @param msg The detail message to be logged.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, Properties props, int source, int level, String msg, boolean multiline);
+ public void log(LogCategory evtClass, Properties props, int source, int level, String msg, boolean multiline);
/**
* Logs an event to the log queue.
@@ -423,7 +423,7 @@ public interface ILogger {
* @param param The parameter in the detail message.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, int source, int level, String msg, Object param, boolean multiline);
+ public void log(LogCategory evtClass, int source, int level, String msg, Object param, boolean multiline);
/**
* Logs an event to the log queue.
@@ -435,7 +435,7 @@ public interface ILogger {
* @param param The parameter in the detail message.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, Properties props, int source, String msg, Object param, boolean multiline);
+ public void log(LogCategory evtClass, Properties props, int source, String msg, Object param, boolean multiline);
/**
* Logs an event to the log queue.
@@ -448,7 +448,7 @@ public interface ILogger {
* @param param The parameter in the detail message.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, Properties props, int source, int level, String msg,
+ public void log(LogCategory evtClass, Properties props, int source, int level, String msg,
Object param, boolean multiline);
/**
@@ -462,7 +462,7 @@ public interface ILogger {
* @param params The parameters in the detail message.
* @param multiline True if the message has more than one line, otherwise false.
*/
- public void log(int evtClass, Properties prop, int source, int level, String msg,
+ public void log(LogCategory evtClass, Properties prop, int source, int level, String msg,
Object params[], boolean multiline);
/*
@@ -476,13 +476,13 @@ public interface ILogger {
* @param multiline True if the message has more than one line, otherwise false.
* @return ILogEvent, a log event.
*/
- public ILogEvent create(int evtClass, Properties prop, int source, int level,
+ public ILogEvent create(LogCategory evtClass, Properties prop, int source, int level,
String msg, Object params[], boolean multiline);
/**
* Register a log event factory. Which will create the desired ILogEvents.
*/
- public void register(int evtClass, ILogEventFactory f);
+ public void register(LogCategory evtClass, ILogEventFactory f);
/**
* Retrieves the associated log queue. The log queue is where issued log events
diff --git a/base/common/src/com/netscape/certsrv/logging/LogCategory.java b/base/common/src/com/netscape/certsrv/logging/LogCategory.java
new file mode 100644
index 000000000..98e66cf8e
--- /dev/null
+++ b/base/common/src/com/netscape/certsrv/logging/LogCategory.java
@@ -0,0 +1,24 @@
+// --- BEGIN COPYRIGHT BLOCK ---
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+//
+// (C) 2017 Red Hat, Inc.
+// All rights reserved.
+// --- END COPYRIGHT BLOCK ---
+package com.netscape.certsrv.logging;
+
+public enum LogCategory {
+ TRANSACTION,
+ SYSTEM,
+ SIGNED_AUDIT
+}
diff --git a/base/common/src/com/netscape/certsrv/ocsp/IOCSPAuthority.java b/base/common/src/com/netscape/certsrv/ocsp/IOCSPAuthority.java
index e32c11e7b..3a2b1fa5c 100644
--- a/base/common/src/com/netscape/certsrv/ocsp/IOCSPAuthority.java
+++ b/base/common/src/com/netscape/certsrv/ocsp/IOCSPAuthority.java
@@ -17,17 +17,18 @@
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.ocsp;
-import netscape.security.x509.X500Name;
-
import org.mozilla.jss.asn1.OBJECT_IDENTIFIER;
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.ISubsystem;
+import com.netscape.certsrv.logging.LogCategory;
import com.netscape.certsrv.security.ISigningUnit;
import com.netscape.cmsutil.ocsp.BasicOCSPResponse;
import com.netscape.cmsutil.ocsp.ResponderID;
import com.netscape.cmsutil.ocsp.ResponseData;
+import netscape.security.x509.X500Name;
+
/**
* This class represents the primary interface for the Online Certificate
* Status Protocol (OCSP) server.
@@ -132,7 +133,7 @@ public interface IOCSPAuthority extends ISubsystem {
* @param level the log message
* @param msg the log message
*/
- public void log(int event, int level, String msg);
+ public void log(LogCategory event, int level, String msg);
/**
* This method retrieves the X500Name of an OCSP server instance.