From 851ab241e3b4d62db6b89e8855b7e297a7a1c1af Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Mon, 28 Oct 2024 16:08:38 +0100 Subject: [PATCH] Revert "refactor RunModesProvider service" This reverts commit 4cdb723a35f7ef43c3c0953e78f7303150091f6a. --- .../apm/api/scripts/LaunchEnvironment.java | 2 +- .../apm/api/services/RunModesProvider.java | 28 +++++++++++++++++++ .../core/launchers/StartupScriptLauncher.java | 2 +- .../apm/core/scripts/ScriptFilters.java | 2 +- .../ScriptsResourceChangeListener.java | 1 + .../apm/core/tools/ApmInstallHook.java | 2 +- .../services/RunModesProviderService.java} | 16 ++++------- 7 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 app/aem/core/src/main/java/com/cognifide/apm/api/services/RunModesProvider.java rename app/aem/core/src/main/java/com/cognifide/apm/{core/services/RunModesProvider.java => runmodes/services/RunModesProviderService.java} (77%) diff --git a/app/aem/core/src/main/java/com/cognifide/apm/api/scripts/LaunchEnvironment.java b/app/aem/core/src/main/java/com/cognifide/apm/api/scripts/LaunchEnvironment.java index c69742d71..8d11c0dff 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/api/scripts/LaunchEnvironment.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/api/scripts/LaunchEnvironment.java @@ -19,7 +19,7 @@ */ package com.cognifide.apm.api.scripts; -import com.cognifide.apm.core.services.RunModesProvider; +import com.cognifide.apm.api.services.RunModesProvider; import java.util.Arrays; import java.util.Optional; import org.apache.commons.lang3.StringUtils; diff --git a/app/aem/core/src/main/java/com/cognifide/apm/api/services/RunModesProvider.java b/app/aem/core/src/main/java/com/cognifide/apm/api/services/RunModesProvider.java new file mode 100644 index 000000000..25967a7d4 --- /dev/null +++ b/app/aem/core/src/main/java/com/cognifide/apm/api/services/RunModesProvider.java @@ -0,0 +1,28 @@ +/*- + * ========================LICENSE_START================================= + * AEM Permission Management + * %% + * Copyright (C) 2013 Wunderman Thompson Technology + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * =========================LICENSE_END================================== + */ +package com.cognifide.apm.api.services; + +import java.util.Set; + +public interface RunModesProvider { + + Set getRunModes(); + +} diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/launchers/StartupScriptLauncher.java b/app/aem/core/src/main/java/com/cognifide/apm/core/launchers/StartupScriptLauncher.java index 2660c32b5..9935ac88f 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/launchers/StartupScriptLauncher.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/launchers/StartupScriptLauncher.java @@ -24,12 +24,12 @@ import com.cognifide.apm.api.scripts.LaunchEnvironment; import com.cognifide.apm.api.scripts.Script; +import com.cognifide.apm.api.services.RunModesProvider; import com.cognifide.apm.api.services.ScriptFinder; import com.cognifide.apm.api.services.ScriptManager; import com.cognifide.apm.core.Property; import com.cognifide.apm.core.services.ModifiedScriptFinder; import com.cognifide.apm.core.services.ResourceResolverProvider; -import com.cognifide.apm.core.services.RunModesProvider; import com.cognifide.apm.core.utils.sling.SlingHelper; import java.util.ArrayList; import java.util.List; diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptFilters.java b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptFilters.java index 8b943dd81..ee6e46eef 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptFilters.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/scripts/ScriptFilters.java @@ -22,7 +22,7 @@ import com.cognifide.apm.api.scripts.LaunchEnvironment; import com.cognifide.apm.api.scripts.LaunchMode; import com.cognifide.apm.api.scripts.Script; -import com.cognifide.apm.core.services.RunModesProvider; +import com.cognifide.apm.api.services.RunModesProvider; import java.util.Date; import java.util.Set; import java.util.function.Predicate; diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/services/ScriptsResourceChangeListener.java b/app/aem/core/src/main/java/com/cognifide/apm/core/services/ScriptsResourceChangeListener.java index b071f53e9..78a2f6e08 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/services/ScriptsResourceChangeListener.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/services/ScriptsResourceChangeListener.java @@ -23,6 +23,7 @@ import com.cognifide.apm.api.scripts.LaunchMode; import com.cognifide.apm.api.scripts.Script; +import com.cognifide.apm.api.services.RunModesProvider; import com.cognifide.apm.api.services.ScriptFinder; import com.cognifide.apm.api.services.ScriptManager; import com.cognifide.apm.core.Apm; diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/tools/ApmInstallHook.java b/app/aem/core/src/main/java/com/cognifide/apm/core/tools/ApmInstallHook.java index 48100a9ac..b74d395f2 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/tools/ApmInstallHook.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/core/tools/ApmInstallHook.java @@ -27,12 +27,12 @@ import com.cognifide.apm.api.scripts.Script; import com.cognifide.apm.api.services.ExecutionMode; import com.cognifide.apm.api.services.ExecutionResult; +import com.cognifide.apm.api.services.RunModesProvider; import com.cognifide.apm.api.services.ScriptFinder; import com.cognifide.apm.api.services.ScriptManager; import com.cognifide.apm.api.status.Status; import com.cognifide.apm.core.services.ModifiedScriptFinder; import com.cognifide.apm.core.services.ResourceResolverProvider; -import com.cognifide.apm.core.services.RunModesProvider; import com.cognifide.apm.core.services.event.ApmEvent; import com.cognifide.apm.core.services.event.EventManager; import com.cognifide.apm.core.utils.sling.SlingHelper; diff --git a/app/aem/core/src/main/java/com/cognifide/apm/core/services/RunModesProvider.java b/app/aem/core/src/main/java/com/cognifide/apm/runmodes/services/RunModesProviderService.java similarity index 77% rename from app/aem/core/src/main/java/com/cognifide/apm/core/services/RunModesProvider.java rename to app/aem/core/src/main/java/com/cognifide/apm/runmodes/services/RunModesProviderService.java index 8890d2a5f..eaafa8ba0 100644 --- a/app/aem/core/src/main/java/com/cognifide/apm/core/services/RunModesProvider.java +++ b/app/aem/core/src/main/java/com/cognifide/apm/runmodes/services/RunModesProviderService.java @@ -17,27 +17,23 @@ * limitations under the License. * =========================LICENSE_END================================== */ -package com.cognifide.apm.core.services; +package com.cognifide.apm.runmodes.services; -import com.cognifide.apm.core.Property; +import com.cognifide.apm.api.services.RunModesProvider; import java.util.Set; import org.apache.sling.settings.SlingSettingsService; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; -@Component( - service = RunModesProvider.class, - property = { - Property.DESCRIPTION + "APM Service for providing run modes", - Property.VENDOR - } -) -public class RunModesProvider { +@Component +public class RunModesProviderService implements RunModesProvider { @Reference private SlingSettingsService slingSettings; + @Override public Set getRunModes() { return slingSettings.getRunModes(); } + }