2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.automation.jsscripting.internal;
15 import java.util.concurrent.locks.Lock;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.automation.module.script.action.ScriptExecution;
19 import org.openhab.core.scheduler.Scheduler;
20 import org.osgi.service.component.annotations.Activate;
21 import org.osgi.service.component.annotations.Component;
22 import org.osgi.service.component.annotations.Reference;
25 * OSGi utility service for providing easy access to script services.
27 * @author Florian Hotze - Initial contribution
29 @Component(immediate = true, service = JSScriptServiceUtil.class)
31 public class JSScriptServiceUtil {
32 private final Scheduler scheduler;
33 private final ScriptExecution scriptExecution;
36 public JSScriptServiceUtil(final @Reference Scheduler scheduler, final @Reference ScriptExecution scriptExecution) {
37 this.scheduler = scheduler;
38 this.scriptExecution = scriptExecution;
41 public Scheduler getScheduler() {
45 public ScriptExecution getScriptExecution() {
46 return scriptExecution;
49 public JSRuntimeFeatures getJSRuntimeFeatures(Lock lock) {
50 return new JSRuntimeFeatures(lock, this);