Skip to content

Commit 41bcd8d

Browse files
committed
Address review
Signed-off-by: Florian Hotze <[email protected]>
1 parent 4688e50 commit 41bcd8d

File tree

6 files changed

+4
-34
lines changed

6 files changed

+4
-34
lines changed

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptEngineFactory.java

-9
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ public interface ScriptEngineFactory {
5858
*/
5959
List<String> getScriptTypes();
6060

61-
/**
62-
* This method returns whether the ScriptEngine supports pre-compilation of scripts.
63-
*
64-
* @return true if pre-compilation is supported, else false
65-
*/
66-
default boolean supportsPreCompilation() {
67-
return false;
68-
}
69-
7061
/**
7162
* This method "scopes" new values into the given ScriptEngine.
7263
*

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/ScriptEngineManager.java

-8
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ public interface ScriptEngineManager {
6161
*/
6262
boolean isSupported(String scriptType);
6363

64-
/**
65-
* Checks if the supplied file extension or MimeType supports pre-compilation.
66-
*
67-
* @param scriptType a file extension (script) or MimeType (ScriptAction or ScriptCondition)
68-
* @return true, if pre-compilation supported, else false
69-
*/
70-
boolean isPreCompilationSupported(String scriptType);
71-
7264
/**
7365
* Add a listener that is notified when a ScriptEngineFactory is added or removed
7466
*

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/ScriptEngineManagerImpl.java

-9
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,6 @@ public boolean isSupported(String scriptType) {
251251
return findEngineFactory(scriptType) != null;
252252
}
253253

254-
@Override
255-
public boolean isPreCompilationSupported(String scriptType) {
256-
ScriptEngineFactory engineFactory = findEngineFactory(scriptType);
257-
if (engineFactory != null) {
258-
return engineFactory.supportsPreCompilation();
259-
}
260-
return false;
261-
}
262-
263254
private void addAttributeToScriptContext(ScriptEngine engine, String name, Object value) {
264255
ScriptContext scriptContext = engine.getContext();
265256

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/AbstractScriptModuleHandler.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,9 @@ private static String getValidConfigParameter(String parameter, Configuration co
8787
}
8888

8989
/**
90-
* Compiles the script if the script engine supports pre-compilation.
90+
* Creates the {@link ScriptEngine} and compiles the script if the {@link ScriptEngine} implements {@link Compilable}.
9191
*/
92-
protected void compileScriptIfSupported() throws ScriptException {
93-
if (!scriptEngineManager.isPreCompilationSupported(type)) {
94-
return;
95-
}
96-
92+
protected void compileScript() throws ScriptException {
9793
if (compiledScript.isPresent()) {
9894
return;
9995
}

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptActionHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void dispose() {
6464

6565
@Override
6666
public void compile() throws ScriptException {
67-
super.compileScriptIfSupported();
67+
super.compileScript();
6868
}
6969

7070
@Override

bundles/org.openhab.core.automation.module.script/src/main/java/org/openhab/core/automation/module/script/internal/handler/ScriptConditionHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ScriptConditionHandler(Condition module, String ruleUID, ScriptEngineMana
4545

4646
@Override
4747
public void compile() throws ScriptException {
48-
super.compileScriptIfSupported();
48+
super.compileScript();
4949
}
5050

5151
@Override

0 commit comments

Comments
 (0)