OSGiBootstrap provides an OSGiFramework through a OSGiBootstrapProvider.
A OSGiBootstrapProvider is discovered in two stages
Read the bootstrap provider class name from a system property
Read the bootstrap provider class name from a resource file
In both cases the key is the fully qualified name of the
org.jboss.osgi.spi.framework.OSGiBootstrapProvider
interface.
The following code shows how to get the default
OSGiFramework
from the
OSGiBootstrapProvider
.
OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider(); OSGiFramework framework = bootProvider.getFramework(); Bundle bundle = framework.getSystemBundle();
The
OSGiBootstrapProvider
can also be configured explicitly. The
OSGiFramework
is a named object from the configuration.
OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider(); bootProvider.configure(configURL); OSGiFramework framework = bootProvider.getFramework(); Bundle bundle = framework.getSystemBundle();
The JBoss OSGi SPI comes with a default bootstrap provider:
OSGiBootstrapProvider implementations that read their configurtation from some other source are possible, but currently not part of the JBoss OSGi SPI.