diff --git a/dspace-api/src/main/java/org/dspace/content/enhancer/service/impl/ItemEnhancerServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/enhancer/service/impl/ItemEnhancerServiceImpl.java index 97816515ea36..ee2444e05ee1 100644 --- a/dspace-api/src/main/java/org/dspace/content/enhancer/service/impl/ItemEnhancerServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/enhancer/service/impl/ItemEnhancerServiceImpl.java @@ -11,6 +11,7 @@ import java.util.List; import java.util.UUID; +import org.apache.logging.log4j.Logger; import org.dspace.authorize.AuthorizeException; import org.dspace.content.Item; import org.dspace.content.dao.ItemForMetadataEnhancementUpdateDAO; @@ -28,6 +29,11 @@ */ public class ItemEnhancerServiceImpl implements ItemEnhancerService { + /** + * log4j category + */ + private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(ItemEnhancerServiceImpl.class); + @Autowired private List itemEnhancers; @@ -41,14 +47,15 @@ public class ItemEnhancerServiceImpl implements ItemEnhancerService { public void enhance(Context context, Item item, boolean deepMode) { boolean isUpdateNeeded = false; if (deepMode) { - itemForMetadataEnhancementUpdateDAO.removeItemForUpdate(context, item.getID()); + final UUID id = item.getID(); + log.debug("deepMode enabled, removing item with uuid {} from the queue", id); + itemForMetadataEnhancementUpdateDAO.removeItemForUpdate(context, id); } for (ItemEnhancer itemEnhancer : itemEnhancers) { if (itemEnhancer.canEnhance(context, item)) { isUpdateNeeded = itemEnhancer.enhance(context, item, deepMode) || isUpdateNeeded; } } - if (isUpdateNeeded) { updateItem(context, item); try { @@ -61,7 +68,8 @@ public void enhance(Context context, Item item, boolean deepMode) { @Override public void saveAffectedItemsForUpdate(Context context, UUID uuid) throws SQLException { - itemForMetadataEnhancementUpdateDAO.saveAffectedItemsForUpdate(context, uuid); + int queued = itemForMetadataEnhancementUpdateDAO.saveAffectedItemsForUpdate(context, uuid); + log.debug("queued {} items for metadata enhancement check", queued); } @Override diff --git a/dspace-server-webapp/pom.xml b/dspace-server-webapp/pom.xml index bd33c731a85e..6b4885b90c9c 100644 --- a/dspace-server-webapp/pom.xml +++ b/dspace-server-webapp/pom.xml @@ -379,7 +379,7 @@ it.4science.dspace - addon-orchestrator + addon-orchestrator-rest ${addon-orchestrator.version} jar diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java index c8c6cd72eb5a..b4af863e6542 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/enhancer/RelatedItemEnhancerUpdatePoller.java @@ -34,14 +34,17 @@ public class RelatedItemEnhancerUpdatePoller { @Scheduled(fixedDelayString = "${related-item-enhancer-poller.delay}") public void pollItemToUpdateAndProcess() { try { + log.debug("item enhancer poller executed"); Context context = new Context(); context.turnOffAuthorisationSystem(); UUID extractedUuid; while ((extractedUuid = itemEnhancerService.pollItemToUpdate(context)) != null) { + log.debug("item enhancer poller processing {}", extractedUuid); Item item = itemService.find(context, extractedUuid); if (item != null) { itemEnhancerService.enhance(context, item, true); } + log.debug("item enhancer poller committing"); context.commit(); } context.restoreAuthSystemState(); diff --git a/dspace/modules/additions/pom.xml b/dspace/modules/additions/pom.xml index 4e7c4d2b9a23..1a474531dc00 100644 --- a/dspace/modules/additions/pom.xml +++ b/dspace/modules/additions/pom.xml @@ -294,7 +294,7 @@ it.4science.dspace - addon-orchestrator + addon-orchestrator-api ${addon-orchestrator.version} jar diff --git a/pom.xml b/pom.xml index 53b4eb7b2b4f..1a992c88f972 100644 --- a/pom.xml +++ b/pom.xml @@ -971,7 +971,13 @@ it.4science.dspace - addon-orchestrator + addon-orchestrator-api + ${addon-orchestrator.version} + jar + + + it.4science.dspace + addon-orchestrator-rest ${addon-orchestrator.version} jar