Skip to end of metadata
Go to start of metadata

The OSGi Bundle has one Java Source file, the Bundle Activator:

Activator.java

The bundle activator is very simple, and just prints out a message when the bundle starts and stops - allowing you to verify that OSGi is working properly.

Now, let's look at the pom.xml, where we create the bundle:

pom.xml
Line numbers Note
10 The packaging of the maven module is set to bundle. This instructs maven and the maven-bundle-plugin to create an OSGi bundle.
62 - 67 Since the activator uses an OSGi interface, these are provided through the OSGi interfaces artifact.
66 Use the provided scope for dependencies that are either provided by the OSGi framework (i.e. JBoss AS) itself or for dependencies that are provided through separate bundles.
71 - 98 The maven-bundle-plugin is used to create a bundle. You can configure it create import and export statements, and to specify the activator in use. You can read more about the OSGi Bundle Maven Plugin on the Apache Felix site.
100 - 108 We can use the jboss-as Maven plugin to deploy the bundle to JBoss AS as usual.

As you can see, using OSGi with JBoss AS is pretty easy!

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.