-
-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Jython and Groovy ScriptEngineFactories #519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one general concern with this change:
The reason that only Javascript is listed is that it is always present.
For Groovy and Jython, additional libraries need to be in place. For installations, where those are not installed, the UI should also not display these options.
I'd thus think that the registration of the factories + config description should be constructed dynamically, wdyt?
@@ -0,0 +1,64 @@ | |||
/** | |||
* Copyright (c) 2019 Contributors to the Eclipse Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the license header from https://github.com/openhab/openhab-core/blob/master/licenses/epl-2.0/header.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I should use this...
Copyright (c) 2010-${year} Contributors to the openHAB project
Or...
Copyright (c) 2010-2019 Contributors to the openHAB project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly the version with the years, not the placeholders!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so... but clearly not so clear to me! Thank you! 😄
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some Javadoc
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some Javadoc
Absolutely, but I did not see how to dynamically construct it. Could you please point me in the right direction on how to do that? |
Well, the first thing is to figure out how to determine whether support of these languages is there or not. For the config options, this should be removed from the static json file and be implemented as an |
Option 3 looks best to me, in case the libraries are manually installed. Adding some bundles for JSR223 libraries is on my list though! What type of bundles would these be? |
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/configuration-of-openhab/64682/203 |
I think 2+3 should be combined.
What do you mean by type? Wrt the id, it could be |
If 3 is implemented, I don't see any need for 2. The bundle could be installed but misconfigured. Checking the classpath will tell us for certain if the libraries are available for use. But I'm rethinking this. Instead of checking the classpath, I can get a list of ScriptEngines from the ScriptEngineManager. I also don't think these factories will be needed, since they are really just providing the MimeType for the ScriptEngine, which is used in the ScriptTypes.json. But I'm thinking the name might be able to be used (need to test), which can also be provided by the SEM. This will also allow for something like a Kotlin library to be added into the the classpath, a ScriptEngine would be created by the GenericScriptEngineFactory, and then it would show up as an option in Paper UI.
I was meaning binding, io, etc., but don't know the right terminology for it. I'm confused by I have a number of questions, so I opened a separate issue for Jython... https://github.com/openhab/openhab2-addons/issues/4801, and I'll open another for Groovy. |
Replaced with #635. |
... and add support for Jython and Groovy scripted Actions and Conditions in Paper UI.
Fixes #521
Signed-off-by: Scott Rushworth openhab@5iver.com (github: openhab-5iver)