I’m working on trying to make add-ons versioned. As a consequence, I’m in contact with most of the code related to add-ons in Core.
I’m currently trying to understand KAR add-ons. This is what I’ve found so far:
- Official add-ons are handled using Karaf features, which is a completely different way from how other add-ons are handled, making it not a focus for me at this time.
- Third party JSON add-ons uses KAR add-ons, which are handled by
JsonAddonService
. I’ve not quite gotten to the bottom of how that is all handled, but it seems to work and doesn’t suffer from the problem I’m currently facing. - Community marketplace add-ons also support KAR I think, but they don’t suffer from the problem here either.
The problem is when it comes to the addons
folder. You can drop JAR files there, and they are installed. When I try to install a KAR file there, it doesn’t work. What happens is that the file itself is picked up and the bundles inside the KAR seems to be installed. But, it doesn’t show up as an add-on. The reason is that to show up as an add-on, OH-INF\addon\addon.xml
must be parsed, and I can’t find any mechanism that currently does that.
JarFileAddonService
handles this for JAR files, but that’s simpler because a JAR file only contains a single bundle. Thus, the “filtering criteria” for JarFileAddonService
is that the bundle’s “location” starts with file:
(I’ve also added http:
and https:
so that add-ons installed as bundles from Karaf shows up). The bundles installed by the KAR file I’ve tested (I don’t know if this is always true for KAR files) and up having a mvn:
type location. I can’t make JarFileAddonService
pick up bundles with mvn:
locations, because that’s also how all the official add-ons are registered. Including mvn:
would thus cause all official add-ons to show up twice under add-ons.
I’ve searched the forum and read through the documentation, but I find very little information. There are some references to installing KAR add-ons on the forum, but they are mostly very old and provides little information relevant here. It does seem to have been something that was done once upon a time at least. The documentation doesn’t mention it at all, it only talks about JARs. But, the fact that KAR files are picked up and the bundles are installed does indicate that it’s “supposed to” work, even if they fail to register as add-ons, while the lack of documentation suggests the opposite.
So, what is it: Is this supposed to work or not?