From 578ad0d6bc408edf9e6c875156054374f5fd8337 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 22 Mar 2021 18:40:26 +0100 Subject: change to EGIZ codestyle --- .../moa/spss/server/logging/IaikLog.java | 37 ++++++++++++++-------- .../moa/spss/server/logging/IaikLogFactory.java | 27 +++++++++------- .../moa/spss/server/logging/IaikLogMsg.java | 37 +++++++++++----------- .../moa/spss/server/logging/TransactionId.java | 17 +++++----- 4 files changed, 65 insertions(+), 53 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java index dcb1397..f477588 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLog.java @@ -21,20 +21,17 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.logging; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import iaik.logging.TransactionId; /** - * An implementation of the iaik.logging.Log - * interface that is based on Jakarta Commons-Logging. - * + * An implementation of the iaik.logging.Log interface that is + * based on Jakarta Commons-Logging. + * * @author Fatemeh Philippi * @version $Id$ */ @@ -45,11 +42,11 @@ public class IaikLog implements iaik.logging.Log { private static Logger log = LoggerFactory.getLogger(IAIK_LOG_HIERARCHY); /** The node ID to use. */ private String nodeId; - + /** * Create a new IaikLog. - * - * @param nodeId The node ID for this Log object. + * + * @param nodeId The node ID for this Log object. */ public IaikLog(String nodeId) { this.nodeId = nodeId; @@ -58,6 +55,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#isDebugEnabled() */ + @Override public boolean isDebugEnabled() { return log.isDebugEnabled(); } @@ -65,8 +63,9 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#debug(TransactionId, Object, Throwable) */ + @Override public void debug(TransactionId transactionId, Object message, Throwable t) { - IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); log.debug(msg.toString(), t); } @@ -74,6 +73,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#isInfoEnabled() */ + @Override public boolean isInfoEnabled() { return log.isInfoEnabled(); } @@ -81,8 +81,9 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#info(TransactionId, Object, Throwable) */ + @Override public void info(TransactionId transactionId, Object message, Throwable t) { - IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); log.info(msg.toString(), t); } @@ -90,6 +91,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#isWarnEnabled() */ + @Override public boolean isWarnEnabled() { return log.isWarnEnabled(); } @@ -97,8 +99,9 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#warn(TransactionId, Object, Throwable) */ + @Override public void warn(TransactionId transactionId, Object message, Throwable t) { - IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); log.warn(msg.toString(), t); } @@ -106,6 +109,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#isErrorEnabled() */ + @Override public boolean isErrorEnabled() { return log.isErrorEnabled(); } @@ -113,8 +117,9 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#error(TransactionId, Object, Throwable) */ + @Override public void error(TransactionId transactionId, Object message, Throwable t) { - IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); log.error(msg.toString(), t); } @@ -122,6 +127,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#isFatalEnabled() */ + @Override public boolean isFatalEnabled() { return log.isErrorEnabled(); } @@ -129,8 +135,9 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#fatal(TransactionId, Object, Throwable) */ + @Override public void fatal(TransactionId transactionId, Object message, Throwable t) { - IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); + final IaikLogMsg msg = new IaikLogMsg(transactionId, nodeId, message); log.error(msg.toString(), t); } @@ -138,6 +145,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#setNodeId(String) */ + @Override public void setNodeId(String nodeId) { this.nodeId = nodeId; } @@ -145,6 +153,7 @@ public class IaikLog implements iaik.logging.Log { /** * @see iaik.logging.Log#getNodeId() */ + @Override public String getNodeId() { return nodeId; } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java index 9989087..e0a4ea6 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogFactory.java @@ -21,7 +21,6 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.logging; import at.gv.egovernment.moaspss.logging.LoggingContext; @@ -31,36 +30,40 @@ import iaik.logging.LogConfigurationException; import iaik.logging.LogFactory; /** - * An implementation of the iaik.logging.LogFactory abstract - * class to log messages to the MOA logging subsystem. - * + * An implementation of the iaik.logging.LogFactory abstract class + * to log messages to the MOA logging subsystem. + * * @author Patrick Peck * @version $Id$ */ public class IaikLogFactory extends LogFactory { + @Override public Log getInstance(Class clazz) throws LogConfigurationException { return getInstanceImpl(clazz.getName()); } + @Override public Log getInstance(String name) throws LogConfigurationException { return getInstanceImpl(name); } /** * Return an instance of iaik.logging.Log. - * + * * @return The iaik.logging.Log object to log messages to. - */ + */ private Log getInstanceImpl(String name) { - LoggingContext context = LoggingContextManager.getInstance().getLoggingContext(); - if (context != null) - return new IaikLog(context.getNodeID()); - else - return new IaikLog("Internal"); - + final LoggingContext context = LoggingContextManager.getInstance().getLoggingContext(); + if (context != null) { + return new IaikLog(context.getNodeID()); + } else { + return new IaikLog("Internal"); + } + } + @Override public void release() { // we do not hold any resources } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java index 7e4ff84..d096b2e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/IaikLogMsg.java @@ -21,34 +21,33 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.logging; import iaik.logging.TransactionId; /** * A unified message type to log messages from the IAIK subsystem. - * + * * @author Patrick Peck * @version $Id$ */ public class IaikLogMsg { - + /** The transaction ID of this message. */ - private TransactionId transactionId; + private final TransactionId transactionId; /** The node ID of this message. */ - private String nodeId; + private final String nodeId; /** The message to log. */ - private Object message; - + private final Object message; + /** * Create a IaikLogMsg object. - * - * @param transactionId The transaction id of the transaction which - * generated this log message. May be null. - * @param nodeId The node id where this message was generated. May be - * null. - * @param message The actual message to log. May be null. + * + * @param transactionId The transaction id of the transaction which generated + * this log message. May be null. + * @param nodeId The node id where this message was generated. May be + * null. + * @param message The actual message to log. May be null. */ public IaikLogMsg(TransactionId transactionId, String nodeId, Object message) { this.transactionId = transactionId; @@ -56,22 +55,22 @@ public class IaikLogMsg { this.message = message; } - /** * Convert this log message to a String. - * - * @return The String representation of this log message. + * + * @return The String representation of this log message. */ + @Override public String toString() { - StringBuffer msg = new StringBuffer(); - + final StringBuffer msg = new StringBuffer(); + msg.append("TID="); msg.append(transactionId != null ? transactionId.getLogID() : ""); msg.append(" NID="); msg.append(nodeId != null ? nodeId : ""); msg.append(" MSG="); msg.append(message != null ? message.toString() : ""); - + return msg.toString(); } diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java index ba76c0b..75623fd 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/logging/TransactionId.java @@ -21,25 +21,24 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ - package at.gv.egovernment.moa.spss.server.logging; /** * An implementation of the iaik.logging.TransactionId interface. - * + * * @author Patrick Peck * @version $Id$ */ public class TransactionId implements iaik.logging.TransactionId { - + /** The String representation for logging the transaction ID. */ - private String logID; - + private final String logID; + /** * Create a TransactionId object. - * + * * @param logID The transaction id as it should be presented to the logging - * subsystem. + * subsystem. */ public TransactionId(String logID) { this.logID = logID; @@ -48,13 +47,15 @@ public class TransactionId implements iaik.logging.TransactionId { /** * @see iaik.logging.TransactionId#getLogID() */ + @Override public String getLogID() { return logID; } - + /** * @see java.lang.Object#toString() */ + @Override public String toString() { return getLogID(); } -- cgit v1.2.3