Class BundleProvisioner

  • Direct Known Subclasses:
    MinimalBundleProvisioner

    public class BundleProvisioner
    extends Object
    Goes through a list of URIs and installs bundles from those locations. It installs the bundles in the same order as they appear in the configuration.

    This class is also responsible for updating or uninstalling bundles during subsequent restart if jars have been updated or deleted.

    It can also be passed a list of URIs of bundles to be started automatically. The list of bundles to be started must be a subset of list of bundles to be installed. The autostart bundles can also be configured with start level. It can be configured to start bundles persistently or transiently.

    This being a provisioning service itself can't expect too many other services to be available. So, it relies on core framework services only.

    Several operations of this class can be customized via a BundleProvisioner.Customizer object. Please refer to BundleProvisioner.DefaultCustomizer for the default policy.

    Author:
    [email protected]
    • Constructor Detail

      • BundleProvisioner

        public BundleProvisioner​(org.osgi.framework.BundleContext bundleContext,
                                 Properties config)
      • BundleProvisioner

        public BundleProvisioner​(org.osgi.framework.BundleContext bundleContext,
                                 com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.Customizer customizer)
    • Method Detail

      • getBundleContext

        public org.osgi.framework.BundleContext getBundleContext()
      • setBundleContext

        public void setBundleContext​(org.osgi.framework.BundleContext bundleContext)
      • installBundles

        public List<Long> installBundles()
        This method goes collects list of bundles that have been installed from the watched directory in previous run of the program, compares them with the current set of jar files, uninstalls old bundles, updates modified bundles, installs new bundles. It returns list of bundle ids provisioned by this provisoner.
      • startBundles

        public void startBundles()
        Go through the list of auto start bundles and start them.
      • uninstall

        protected int uninstall​(List<com.sun.enterprise.glassfish.bootstrap.osgi.Jar> bundles)
      • refresh

        public void refresh()
        Refresh packages
      • hasAnyThingChanged

        public boolean hasAnyThingChanged()
        Returns:
        true if anything changed since last time framework was initialized
      • isSystemBundleUpdationRequired

        public boolean isSystemBundleUpdationRequired()
        Returns:
        true if system bundle needs to be updated because of bundles getting updated or deleted or installed.
      • setSystemBundleUpdationRequired

        protected void setSystemBundleUpdationRequired​(boolean systemBundleUpdationRequired)
      • getNoOfUninstalledBundles

        public int getNoOfUninstalledBundles()
        Returns:
        no of bundles uninstalled
      • getNoOfUpdatedBundles

        public int getNoOfUpdatedBundles()
        Returns:
        no of bundles updated
      • getNoOfInstalledBundles

        public int getNoOfInstalledBundles()
        Returns:
        no of bundles installed
      • getCustomizer

        public com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.Customizer getCustomizer()
      • main

        public static void main​(String[] args)
                         throws Exception
        A simple main method to test this class
        Parameters:
        args -
        Throws:
        Exception