Save This Page
Home » » » [javadoc | source]
class: BootstrapInstaller [javadoc | source]

All Implemented Interfaces:
    org.osgi.framework.BundleActivator, org.osgi.framework.FrameworkListener

The BootstrapInstaller class is installed into the OSGi framework as an activator to be called when the framework is starting up. Upon startup all bundles from the #PATH_CORE_BUNDLES and the #PATH_BUNDLES location are checked whether they are already installed or not. If they are not installed, they are installed, their start level set to 1 and started. Any bundle already installed is not installed again and will also not be started here.
Field Summary
static final  String PATH_CORE_BUNDLES    The location of the core Bundles (value is "resources/corebundles"). These bundles are installed at startlevel #STARTLEVEL_CORE_BUNDLES .

This location is deprecated, instead these core bundles should be located in resources/bundles/1

static final  String PATH_BUNDLES    The location the additional Bundles (value is "resources/bundles"). These Bundles are installed after the core Bundles
static final  String BND_LAST_MODIFIED_HEADER    The header which contains the bundle's last modified date. 
 BootstrapInstaller(Logger logger,
    ResourceProvider resourceProvider,
    Map<String, String> props) 
Method from Summary:
copyStreamToFile,   extractFileName,   frameworkEvent,   getBundleSymbolicName,   getManifest,   isBlank,   isBundle,   start,   stop
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 static  void copyStreamToFile(InputStream fromStream,
    File toFile) throws IOException 
    Copies a stream from the resource (jar/war) to a file
 static String extractFileName(String path) 
 public  void frameworkEvent(FrameworkEvent event) 
    Called whenever a framework event is taking place. This method only cares for the framework event emitted once the framework startup has completed. Once the framework startup has completed, this method takes further actions (besides unregistering as a framework listener):
    • If bundle installation in the #start(BundleContext) method included an update of a framework extension fragment bundle, the framework has to be restarted. This is effectuated by calling the Bundle.update() method on the system bundle.
    • If a restart is not required, the StartLevel service is instructed to raise the framework start level to the value requested by the framework launcher.
 String getBundleSymbolicName(Manifest manifest) 
    Returns the Bundle-SymbolicName header from the given manifest or null if no such header exists.

    Note that bundles are not allowed to have no symbolic name any more. Therefore a bundle without a symbolic name header should not be installed.

 Manifest getManifest(InputStream ins) 
    Return the manifest from a jar if it is possible to get it, this will also handle closing out the stream
 static boolean isBlank(String str) 
    Simple check to see if a string is blank since StringUtils is not available here, maybe fix this later
 static boolean isBundle(String path) 
    Determine if a path could be a bundle based on its extension.
 public  void start(BundleContext context) throws Exception Handles the initial detection and installation of bundles into the Felix OSGi running in Sling Process: 1) Copy all bundles from enclosed resources (jar/war) to ${sling.home}/startup. This gives something like ${sling.home}/startup/0, /1, /10, /15, ... Existing files are only replaced if the files enclosed in the Sling launchpad jar/war file are newer. 2) Scan ${sling.home}/startup for bundles to install in the same way as today the enclosed resources are scanned directly. So you could place your bundles in that structure and get them installed at the requested start level (0 being "default bundle start level").
 public  void stop(BundleContext context) 
    Nothing to be done on stop