From 6379836396de6279fc94ff9a8db688f0d9a00266 Mon Sep 17 00:00:00 2001 From: Wim Maerevoet Date: Mon, 13 Nov 2023 13:33:41 +0100 Subject: [PATCH] Allow statistics service to be loaded from plugin directory --- .../oxalis/commons/statistics/StatisticsModule.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/oxalis-commons/src/main/java/network/oxalis/commons/statistics/StatisticsModule.java b/oxalis-commons/src/main/java/network/oxalis/commons/statistics/StatisticsModule.java index 09ee47ded..952f63f94 100644 --- a/oxalis-commons/src/main/java/network/oxalis/commons/statistics/StatisticsModule.java +++ b/oxalis-commons/src/main/java/network/oxalis/commons/statistics/StatisticsModule.java @@ -25,6 +25,8 @@ import com.google.inject.Injector; import com.google.inject.Provides; import com.google.inject.Singleton; +import com.google.inject.name.Named; +import network.oxalis.api.plugin.PluginFactory; import network.oxalis.api.settings.Settings; import network.oxalis.api.statistics.StatisticsService; import network.oxalis.commons.guice.ImplLoader; @@ -44,4 +46,11 @@ protected void configure() { protected StatisticsService getStatisticsService(Injector injector, Settings settings) { return ImplLoader.get(injector, StatisticsService.class, settings, StatisticsConf.SERVICE); } + + @Provides + @Singleton + @Named("statistics-plugin") + protected StatisticsService getPluginStatisticsService(PluginFactory pluginFactory) { + return pluginFactory.newInstance(StatisticsService.class); + } }