JBoss.orgCommunity Documentation

Chapter 4. Framework Integration

4.1. JBossMC Framework Integration
4.2. Apache Felix Integration
4.3. Equinox Integration

Starting from 1.0.0.Beta4 JBoss OSGi provides integration for our native Microcontainer based OSGi Framework. When deployed in JBossAS this Framework will eventually allow us to integrate with components from other programming models. (i.e. OSGi services can access MC beans, EJB3 can access OSGi services and vice versa)

JBossMC integration can be configured through an XML beans configuration in the JBoss OSGi Runtime.



cat server/default/conf/jboss-osgi-bootstrap.xml 

<deployment xmlns="urn:jboss:bean-deployer:2.0">

  <!-- The OSGiFramework -->
  <bean name="OSGiBundleManager" class="org.jboss.osgi.framework.bundle.OSGiBundleManager">
  <property name="properties">
    ...
  </property>
  </bean>
...
</deployment>
    

In the JBossAS integration we also use JBoss Microcontainer beans configuration.

JBoss OSGi provides integration for the Apache Felix OSGi Framework and some of its core services

The Apache Felix integration can be configured through properties in the JBoss OSGi Runtime.

cat conf/jboss-osgi-framework.properties 

# Properties to configure the Framework
org.osgi.framework.storage=${osgi.server.home}/data/osgi-store
org.osgi.framework.storage.clean=onFirstInit

# Hot Deployement
org.jboss.osgi.hotdeploy.scandir=${osgi.server.home}/bundles

...

# Bundles that need to be installed with the Framework automatically 
org.jboss.osgi.spi.framework.autoInstall=\
  file://${osgi.home}/server/minimal/bundles/org.osgi.compendium.jar

# Bundles that need to be started automatically 
org.jboss.osgi.spi.framework.autoStart=\
   file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
   file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
   file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
    

In the JBossAS integration we use JBoss Microcontainer beans configuration.



cat server/default/deployers/osgi.deployer/META-INF/osgi-deployers-jboss-beans.xml 

<deployment xmlns="urn:jboss:bean-deployer:2.0">

  <!-- The OSGiFramework -->
  <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.FelixIntegration">
    <property name="properties">
       ...
    </property>
    <property name="autoStart">
     <list elementClass="java.net.URL">
      ...
     </list>
    </property>
  </bean>
  ...
</deployment>
    

The following is a description of the configuration properties for the Apache Felix integration.

KeyValueDescription
org.osgi.framework.storage .../osgi-store OSGi Framework storage area
org.osgi.framework.storage.clean onFirstInit Clean the storage area on first init
org.osgi.service.http.port 8090 The default Http Service port
felix.cm.dir .../osgi-configadmin Config Admin Service storage area
org.osgi.framework.system.packages.extra javax.management, javax.xml... Packages provided by the OSGi System ClassLoader
org.jboss.osgi.deferred.start true Bundles can be deployed in any order

JBoss OSGi also provides basic integration for the Eclipse Equinox OSGi Framework.

Equinox integration can be configured through properties in the JBoss OSGi Runtime.



cat conf/jboss-osgi-framework.properties 

# Properties to configure the Framework
org.osgi.framework.storage=${osgi.server.home}/data/osgi-store
org.osgi.framework.storage.clean=onFirstInit

# Hot Deployement
org.jboss.osgi.hotdeploy.scandir=${osgi.server.home}/bundles

...

# Bundles that need to be installed with the Framework automatically 
org.jboss.osgi.spi.framework.autoInstall=\
 file://${osgi.home}/server/minimal/deploy/org.eclipse.osgi.services.jar \
 file://${osgi.home}/server/minimal/deploy/org.eclipse.osgi.util.jar

# Bundles that need to be started automatically 
org.jboss.osgi.spi.framework.autoStart=\
   file://${osgi.home}/server/minimal/bundles/org.apache.felix.log.jar \
   file://${osgi.home}/server/minimal/bundles/jboss-osgi-common.jar \
   file://${osgi.home}/server/minimal/bundles/jboss-osgi-hotdeploy.jar
    

In the JBossAS integration we use JBoss Microcontainer beans configuration.



<deployment xmlns="urn:jboss:bean-deployer:2.0">

  <!-- The OSGiFramework -->
  <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.equinox.EquinoxIntegration">
    <property name="properties">
       ...
    </property>
    <property name="autoStart">
     <list elementClass="java.net.URL">
      ...
     </list>
    </property>
  </bean>
  ...
</deployment>