2 * Copyright (c) 2010-2022 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 org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.automation.module.script.action.ScriptExecution;
17 import org.openhab.core.scheduler.Scheduler;
18 import org.osgi.service.component.annotations.Activate;
19 import org.osgi.service.component.annotations.Component;
20 import org.osgi.service.component.annotations.Reference;
23 * OSGi utility service for providing easy access to script services.
25 * @author Florian Hotze - Initial contribution
27 @Component(immediate = true, service = JSScriptServiceUtil.class)
29 public class JSScriptServiceUtil {
30 private final Scheduler scheduler;
31 private final ScriptExecution scriptExecution;
34 public JSScriptServiceUtil(final @Reference Scheduler scheduler, final @Reference ScriptExecution scriptExecution) {
35 this.scheduler = scheduler;
36 this.scriptExecution = scriptExecution;
39 public Scheduler getScheduler() {
43 public ScriptExecution getScriptExecution() {
44 return scriptExecution;
47 public JSRuntimeFeatures getJSRuntimeFeatures(Object lock) {
48 return new JSRuntimeFeatures(lock, this);