-
Notifications
You must be signed in to change notification settings - Fork 783
Introduce a mechanism to easily register action method signatures #997
Comments
What exactly is the problem that you cannot provide actions later by some bundle? Is it that the Xtext grammar needs to know everything in advance? Isn't this the use case of Xbase integration in the grammar? Or is it an issue with class loading? Maybe fragments or buddy policy help? |
The code that provides the action definitions for the scripts/rules can be found here. |
Hmm... the Designer is an Eclipse RCP Application, so why don't we use Eclipse mechanisms? The Bundles could be explicit Eclipse Plugins and register themselves either via Eclipse extension point or OSGi Service. Eclipse would then resolve all the necessary dependencies if they are provided by any known update site. |
Well, they are explizit OSGi bundles and thus can be installed on RCP, yes. |
This definitely is a pain. The root-cause for all this is the fact that we actually are running more or less a complete runtime framework inside the designer. To my understanding we are doing this mainly to allow the scripts and rules (i.e. Xbase) to use the classpath for looking up what kind of commands should be there. IMHO this completely sucks. For sure, Xbase by default uses the classpath to resolve its stuff. However, this does not have to stay like that. We could have our own type provider implementation which feeds Xbase with whatever we think should be available (or not...). We don't need access to the real java classes for this, as long as we know how they look like. Now, assuming we could do the above magic, don't have a full ESH framework running underneath and simply operate on the DSLs: Where do you then know what actions should be available? One way of solving this would be to introduce a direct connection to the real runtime. I.e. extend it with a REST API to read the available actions (together with all their methods and arguments). This would "break" the concept that the designer is a real standalone one, because without the connection to the runtime it cannot tell which extensions are there. But let's face it: It is broken today too. WDYT? |
Yes, having a REST connection was also the intention of #619 and being able to directly read the available actions would be nice. I only fear that this will mean quite some implementation work, which might not be long-lasting. My hope would be to offer a "designer runtime extension" in the future (see #1402), which would then naturally have access to all details of the runtime (as this is where it is running itself then). So as a mid-term solution, I think we could do e.g. with an "action.xml" file that the Designer could reference (or e.g. expect to find it in the configuration folder), which could contain information about the solution specific actions (for openHAB, we could maintain such a file that simply has all actions available). Also note, that with the new rule engine, the "old" actions will be obsolete some day and we might rather allow Xbase to access module types (and we wrap old actions into a module type for backward compatibility). |
The designer is not actively maintained anymore, please see #4139 (comment). @SJKA please close. |
The Designer of openHAB 1 had most bundles containing actions included and thus way able to resolve these actions in the rule&script editors (for auto-completion, syntax checks etc.).
It also included the possibility to add further bundles in an
addons
folder by the user, although this mechanism never worked well.The ESH Designer only contains a few "core ESH" actions. As it is not feasible to automatically bundle action-addons with it, there should be a way to easily add such method signatures (the code itself is not required for the editors).
The text was updated successfully, but these errors were encountered: