From ab2cf01520828616c70327cb9ea732e5b808f3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Fri, 28 Jun 2024 19:44:33 +0200 Subject: [PATCH] expose cron schedule entries in EventManager --- .../java/org/xbib/event/clock/ClockEventManagerService.java | 6 ++++++ .../src/main/java/org/xbib/event/common/EventManager.java | 6 ++++++ gradle.properties | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/event-common/src/main/java/org/xbib/event/clock/ClockEventManagerService.java b/event-common/src/main/java/org/xbib/event/clock/ClockEventManagerService.java index 9a40879..1f920e5 100644 --- a/event-common/src/main/java/org/xbib/event/clock/ClockEventManagerService.java +++ b/event-common/src/main/java/org/xbib/event/clock/ClockEventManagerService.java @@ -1,5 +1,6 @@ package org.xbib.event.clock; +import java.util.List; import org.xbib.event.Event; import org.xbib.event.common.AbstractEventManagerService; import org.xbib.event.common.EventManager; @@ -15,6 +16,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ThreadFactory; import java.util.logging.Level; import java.util.logging.Logger; +import org.xbib.time.schedule.Entry; public class ClockEventManagerService extends AbstractEventManagerService implements EventManagerService { @@ -75,4 +77,8 @@ public class ClockEventManagerService extends AbstractEventManagerService implem public void publish(Event event) { eventManager.publish(event); } + + public List> getCronScheduleEntries() { + return cronSchedule.getEntries(); + } } diff --git a/event-common/src/main/java/org/xbib/event/common/EventManager.java b/event-common/src/main/java/org/xbib/event/common/EventManager.java index 9cabd16..45ee182 100644 --- a/event-common/src/main/java/org/xbib/event/common/EventManager.java +++ b/event-common/src/main/java/org/xbib/event/common/EventManager.java @@ -39,6 +39,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.logging.Logger; +import org.xbib.time.schedule.Entry; public final class EventManager extends AbstractEventManagerService implements EventManagerService { @@ -196,6 +197,11 @@ public final class EventManager extends AbstractEventManagerService implements E publish(event); } + public List> getCronScheduleEntries() { + ClockEventManagerService clockEventManagerService = getClockEventManagerService(); + return clockEventManagerService != null ? clockEventManagerService.getCronScheduleEntries() : List.of(); + } + public void shutdown() throws IOException { for (EventConsumer eventConsumer : builder.eventConsumers) { if (eventConsumer instanceof Closeable closeable) { diff --git a/gradle.properties b/gradle.properties index 8429c56..0976aeb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ group = org.xbib name = event -version = 0.3.0 +version = 0.4.0