Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSR223: make clear two different implementations of RuleRegistry are injected #2360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dilyanpalauzov
Copy link
Contributor

For some reason JSR223 injects two different implementations of the org.openhab.core.automation interface.

This is confirmed by the Groovy code below:

import org.openhab.core.automation.RuleRegistry

org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("a1")

scriptExtension.importPreset("RuleSupport")
logger.info(rules.class.toString())
logger.info(rules instanceof RuleRegistry? "true": "false") // from Default preset
logger.info(rules instanceof org.openhab.core.automation.Action ? "true" : "false")

logger.info(ruleRegistry.class.toString())
logger.info(ruleRegistry instanceof RuleRegistry ? "true" : "false") // from RuleSupport preset
logger.info(ruleRegistry instanceof org.openhab.core.automation.Action ? "true" : "false")

which prints

2024-09-04 14:11:12.512 [INFO ] [ort.loader.AbstractScriptFileWatcher] - (Re-)Loading script '/etc/openhab/automation/jsr223/t.groovy'
2024-09-04 14:11:12.551 [INFO ] [a1 ] - class org.openhab.core.automation.internal.RuleRegistryImpl
2024-09-04 14:11:12.553 [INFO ] [a1 ] - true
2024-09-04 14:11:12.555 [INFO ] [a1 ] - false
2024-09-04 14:11:12.560 [INFO ] [a1 ] - class org.openhab.core.automation.module.script.rulesupport.shared.RuleSupportRuleRegistryDelegate
2024-09-04 14:11:12.562 [INFO ] [a1 ] - true
2024-09-04 14:11:12.563 [INFO ] [a1 ] - false

I asked for the rationale on this at https://community.openhab.org/t/why-does-jsr223-provide-two-implementations-of-the-ruleregistry-interface/.

Copy link

netlify bot commented Sep 4, 2024

Thanks for your pull request to the openHAB documentation! The result can be previewed at the URL below (this comment and the preview will be updated if you add more commits).

Built without sensitive environment variables

Name Link
🔨 Latest commit 8e90786
🔍 Latest deploy log https://app.netlify.com/sites/openhab-docs-preview/deploys/66d84169f06f0c000853cf29
😎 Deploy Preview https://deploy-preview-2360--openhab-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant