Class BundleProvisioner
- java.lang.Object
-
- com.sun.enterprise.glassfish.bootstrap.osgi.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 aBundleProvisioner.Customizer
object. Please refer toBundleProvisioner.DefaultCustomizer
for the default policy.- Author:
- [email protected]
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BundleProvisioner.DefaultCustomizer
This is default implementation ofBundleProvisioner.Customizer
which uses the URI of the Jar as location.
-
Constructor Summary
Constructors Constructor Description BundleProvisioner(org.osgi.framework.BundleContext bundleContext, com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.Customizer customizer)
BundleProvisioner(org.osgi.framework.BundleContext bundleContext, Properties config)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.osgi.framework.BundleContext
getBundleContext()
com.sun.enterprise.glassfish.bootstrap.osgi.BundleProvisioner.Customizer
getCustomizer()
int
getNoOfInstalledBundles()
int
getNoOfUninstalledBundles()
int
getNoOfUpdatedBundles()
boolean
hasAnyThingChanged()
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.boolean
isSystemBundleUpdationRequired()
static void
main(String[] args)
A simple main method to test this classvoid
refresh()
Refresh packagesvoid
setBundleContext(org.osgi.framework.BundleContext bundleContext)
protected void
setSystemBundleUpdationRequired(boolean systemBundleUpdationRequired)
void
startBundles()
Go through the list of auto start bundles and start them.protected int
uninstall(List<com.sun.enterprise.glassfish.bootstrap.osgi.Jar> bundles)
-
-
-
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()
-
-