Addons vs. OSGi

Hi,

I was wondering if it would be possible to have all Add-Ons provide OSGi metadata in their package. While Vaadin itself is packaged in a JAR with OSGi metadata and can be used a s a bundle in an OSGi container, the addons I’m using (CustomFIeld and CodeMirror) are not.

If Add-On packages are provided by authors, maybe their manifest could be enhanced with OSGi entries before providing them as a download.

Regards,
Matt

+1 for this - it’s occurred to me too!

And we’re already generating pom:s, how hard can it be :wink:

…I’m sure this is more complicated than it sounds, but it sure would be a nice feature.

Best Regards,
Marc

Sounds like a good feature for Directory. Please create a ticket for it.

Ticket created (note: in our internal issue tracker). Obviously no ETA, but I linked here, so hopefully someone will update this ticket when the issue progresses.

// Marc

Great news, thanks.

In case it helps anyone, my current workaround is to include add-on JARs without OSGi manifest entries in another bundle and export them:


			<!-- OSGi Bundle Plugin -->
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.3.4</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						…
						<!-- Embed Vaadin Add-Ons that do not provide OSGi metadata -->
						<Embed-Dependency>*;artifactId=codemirror|customfield</Embed-Dependency>
						<_exportcontents>org.vaadin.addon.*,org.vaadin.codemirror.*</_exportcontents>
						…
					</instructions>
				</configuration>
			</plugin>

The idea is nice, but I still have questions.

I try to use vaadin together with vaadin addons as normal OSGi bundles. To add non-OSGi vaadin addons to OSGi is not difficle. Simple create lib dir, put addon inside, in MANIFEST add jar(s) to class path and reexport content of jars

The problem is to redistribute widgets from addon to host vaadin bundle dynamically (without recompiling). Vaadin based on the GWT. GWT creates one compilled cache (java script) for whole application (vaadin + addons).
I see two ways to update a cache by addon activation/deactivation.
First one is to recompile a cache after activation/deactivation of vaadin-bundles → to slow
Second is merge already compiled caches from vaadin and activated addon bundles on fly.
The main problem there is names of global variables and functions in vaadin cache and addons cache. Theoretically it’s possible to change equal names in caches and adapt calls onLoad(). Rhiho js-parser from mozilla can help there.

The best solution is of course if GWT will support “including” mechanism for js-caches.