General FAB questions

General questions about the idea of Fuse Bundles (or FABs).

For questions on the Fuse project as a whole see the Fuse FAQ

What is a Fuse Bundle?

A Fuse Bundle, or FAB, is any jar created using Apache Maven or similar build tools so that inside the jar there is a pom.xml file at

META-INF/maven/groupId/artifactId/pom.xml (and pom.properties file)

which contain the transitive dependency information for the jar.

Which build tools generate FABs?

Currently we know these tools generate valid FABs out of the box

Most other popular Java centric build tools properly work too (like Ant+Ivy & Gradle etc); they just need to make a jar with the pom inside.

If you know of another build tool that does this then please let us know so we can add it to our list of supported build tools.

Which containers support FABs?

How does FAB compare to using an OSGi tool to generate the manifest?

There are various tools out there to generate the OSGi manifest information like the Felix Maven Bundle Plugin, BND, Bndtools or the MANIFEST.MF editor in Eclipse.

You have to be a little bit careful with these tools as they only do bytecode analysis and code can refer to class names using indirect means like META-INF/services which won't work with these tools (though they do work with Fuse Bundles inside Fuse ESB).

Though these tools are useful and help the situation for sure; but we've found that using the tools doesn't hide you from the issues; developers have to learn all the OSGi metadata details and how to use them plus they have to learn all about the code generation tools as you frequently hit a wall and have to tweak things; excluding imports or marking imports as optional or whatever.

Fuse bundles on the other hand offer a few advantages over the existing OSGi code generation tools

In summary Fuse Bundles are very easy to use - they build on the standard build tools and current build configurations; there's no steep OSGi learning curve for developers and when it comes to deploying them they just work; there's no secondary deployment model of other archives of feature files required to install them.

Can I use FABs inside Features Files or KARs?

The quick answer is yes :).

To use FABs in any kind of archive that contains multiple bundles, just add the fab: prefix to the URI of the bundle.

For example here is how to add a FAB to a features XML file.

<features>
  <feature name="myFeature" version="1.0">
    <bundle>fab:mvn:myGroupId/myArtifact/1.0</bundle>
  </feature>
</features>

Does a FAB have any OSGi limitations?

Quick answer: no not really :)

A FAB automatically creates the actual OSGi metadata if you don't specify any; using the pom.xml to figure out the transitive dependencies of your FAB.

You still have full access to all the OSGi capabilities so you can always add an explicit Import-Package or Require-Bundle or whatever to your manifest if you really want to.

However FAB is designed so you typically don't need to deal with the actual low level OSGi metaadata and can instead reuse existing Java build systems like Maven, SBT etc.

Using Fuse Bundles

Questions on using Fuse Bundles

How do I install a FAB?

To install a FAB with some value of groupId, artfactId, version type the following command into the console of either Fuse ESB or Apache Karaf (if it has the Fuse bundle feature installed)

install fab:mvn:groupId/artifactId/version

The fab: prefix means treat the given jar as a FAB (Fuse Bundle). This also works with other URIs to mvn: such as file: or http: etc.

Or you can copy a FAB as a file ending in .fab (rather than .jar) to the deploy directory of your container, or use the command line shell in Fuse ESB or Karaf

How do I enable FAB support in my OSGi container?

Just install the fuse-bundle feature in your OSGi container.

For example in an Apache Karaf distro run

features:addUrl mvn:org.fusesource.fuse/fuse-fuse/7.0.1.fuse-084/xml/features
features:install fuse-bundle