From e3200eb262d00f3eedf81a4bd2ef3ebf5466ae45 Mon Sep 17 00:00:00 2001 From: Bhagya Silva Date: Sat, 19 Oct 2024 23:32:48 +0200 Subject: [PATCH] Adding support for Slf4j #4 --- README.md | 5 +++++ .../component/NumberingComponentImpl.java | 6 +++--- .../numbering/policy/AbstractNumberingPolicy.java | 11 ++++++----- .../numbering/policy/SampleNumberingPolicy.java | 5 +++-- .../storage/AttributeNumberingStorageImpl.java | 5 +++-- .../storage/NodeNumberingStorageImpl.java | 14 ++++++++------ .../NumberingComponentIntegrationTest.java | 4 ++-- 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5acb225..7be1a6e 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,8 @@ Authors Marcus Svartmark - Redpill Linpro AB + +Contributors +------- +Bhagya Silva - Loftux AB + diff --git a/repo/src/main/java/org/redpill/alfresco/numbering/component/NumberingComponentImpl.java b/repo/src/main/java/org/redpill/alfresco/numbering/component/NumberingComponentImpl.java index a230dc3..83c6ef1 100644 --- a/repo/src/main/java/org/redpill/alfresco/numbering/component/NumberingComponentImpl.java +++ b/repo/src/main/java/org/redpill/alfresco/numbering/component/NumberingComponentImpl.java @@ -12,12 +12,12 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; +import org.slf4j.Logger; import org.redpill.alfresco.numbering.decorator.Decorator; import org.redpill.alfresco.numbering.storage.NumberingStorage; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; - +import org.slf4j.LoggerFactory; /** * This component handles numbering of objects * @@ -26,7 +26,7 @@ */ public class NumberingComponentImpl implements NumberingComponent, InitializingBean { - private static final Logger LOG = Logger.getLogger(NumberingComponentImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(NumberingComponentImpl.class); protected Repository repositoryHelper; protected NodeService nodeService; diff --git a/repo/src/main/java/org/redpill/alfresco/numbering/policy/AbstractNumberingPolicy.java b/repo/src/main/java/org/redpill/alfresco/numbering/policy/AbstractNumberingPolicy.java index fc4e571..2a7f022 100644 --- a/repo/src/main/java/org/redpill/alfresco/numbering/policy/AbstractNumberingPolicy.java +++ b/repo/src/main/java/org/redpill/alfresco/numbering/policy/AbstractNumberingPolicy.java @@ -1,12 +1,9 @@ package org.redpill.alfresco.numbering.policy; -import java.io.Serializable; -import java.util.Map; import org.alfresco.model.ContentModel; import org.alfresco.repo.copy.CopyBehaviourCallback; import org.alfresco.repo.copy.CopyDetails; import org.alfresco.repo.copy.DefaultCopyBehaviourCallback; -import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy; import org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; @@ -22,14 +19,18 @@ import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; import org.redpill.alfresco.numbering.component.NumberingComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; +import java.io.Serializable; +import java.util.Map; + public abstract class AbstractNumberingPolicy implements NumberingPolicy, OnAddAspectPolicy, OnMoveNodePolicy, InitializingBean { - private static final Logger LOG = Logger.getLogger(AbstractNumberingPolicy.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractNumberingPolicy.class); protected PolicyComponent policyComponent; protected NodeService nodeService; diff --git a/repo/src/main/java/org/redpill/alfresco/numbering/policy/SampleNumberingPolicy.java b/repo/src/main/java/org/redpill/alfresco/numbering/policy/SampleNumberingPolicy.java index 24e61a4..62a7948 100644 --- a/repo/src/main/java/org/redpill/alfresco/numbering/policy/SampleNumberingPolicy.java +++ b/repo/src/main/java/org/redpill/alfresco/numbering/policy/SampleNumberingPolicy.java @@ -4,12 +4,13 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; public class SampleNumberingPolicy extends AbstractNumberingPolicy implements InitializingBean { - private static final Logger LOG = Logger.getLogger(SampleNumberingPolicy.class); + private static final Logger LOG = LoggerFactory.getLogger(SampleNumberingPolicy.class); @Override protected boolean allowUpdate(final NodeRef nodeRef) { diff --git a/repo/src/main/java/org/redpill/alfresco/numbering/storage/AttributeNumberingStorageImpl.java b/repo/src/main/java/org/redpill/alfresco/numbering/storage/AttributeNumberingStorageImpl.java index 6390354..c58f3a6 100644 --- a/repo/src/main/java/org/redpill/alfresco/numbering/storage/AttributeNumberingStorageImpl.java +++ b/repo/src/main/java/org/redpill/alfresco/numbering/storage/AttributeNumberingStorageImpl.java @@ -4,7 +4,8 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.service.cmr.attributes.AttributeService; import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; @@ -16,7 +17,7 @@ */ public class AttributeNumberingStorageImpl implements NumberingStorage, InitializingBean { - private static final Logger LOG = Logger.getLogger(AttributeNumberingStorageImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(AttributeNumberingStorageImpl.class); protected static long DEFAULT_LOCK_TTL = 30000L; protected ThreadLocal lockThreadLocal = new ThreadLocal(); diff --git a/repo/src/main/java/org/redpill/alfresco/numbering/storage/NodeNumberingStorageImpl.java b/repo/src/main/java/org/redpill/alfresco/numbering/storage/NodeNumberingStorageImpl.java index beba68a..7f9777c 100644 --- a/repo/src/main/java/org/redpill/alfresco/numbering/storage/NodeNumberingStorageImpl.java +++ b/repo/src/main/java/org/redpill/alfresco/numbering/storage/NodeNumberingStorageImpl.java @@ -1,9 +1,5 @@ package org.redpill.alfresco.numbering.storage; -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.repo.lock.JobLockService; @@ -17,10 +13,16 @@ import org.alfresco.service.cmr.search.SearchService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * Store numbers using node service. This is well tested and cluster safe. * @@ -32,7 +34,7 @@ public class NodeNumberingStorageImpl implements NumberingStorage, InitializingB protected static final String NUMBERING_FOLDER_NAME = "Numbering"; private static final QName NUMBERING_FOLDER_QNAME = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, NUMBERING_FOLDER_NAME); protected static final QName NUMBERING_PROPERTY = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "counterValue"); - private static final Logger LOG = Logger.getLogger(NodeNumberingStorageImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(NodeNumberingStorageImpl.class); protected static long DEFAULT_LOCK_TTL = 30000L; protected ThreadLocal lockThreadLocal = new ThreadLocal(); diff --git a/repo/src/test/java/org/redpill/alfresco/numbering/it/component/NumberingComponentIntegrationTest.java b/repo/src/test/java/org/redpill/alfresco/numbering/it/component/NumberingComponentIntegrationTest.java index 2056c29..ff15028 100644 --- a/repo/src/test/java/org/redpill/alfresco/numbering/it/component/NumberingComponentIntegrationTest.java +++ b/repo/src/test/java/org/redpill/alfresco/numbering/it/component/NumberingComponentIntegrationTest.java @@ -7,7 +7,7 @@ import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteInfo; -import org.apache.log4j.Logger; +import org.slf4j.Logger; import static org.junit.Assert.assertEquals; import org.junit.Test; import org.redpill.alfresco.numbering.component.NumberingComponent; @@ -24,7 +24,7 @@ */ public class NumberingComponentIntegrationTest extends AbstractRepoIntegrationTest { - private static final Logger LOG = Logger.getLogger(NumberingComponentIntegrationTest.class); + private static final Logger LOG = LoggerFactory.getLogger(NumberingComponentIntegrationTest.class); private static final String DEFAULT_USERNAME = "testuser_" + System.currentTimeMillis();