Package org.eclipse.jetty.ee10.osgi.boot
Class PackageAdminServiceTracker
java.lang.Object
org.eclipse.jetty.ee10.osgi.boot.PackageAdminServiceTracker
- All Implemented Interfaces:
- EventListener,- org.osgi.framework.ServiceListener
public class PackageAdminServiceTracker
extends Object
implements org.osgi.framework.ServiceListener
PackageAdminServiceTracker
 
When the PackageAdmin service is activated we can look for the fragments attached to this bundle and do a fake "activate" on them.
See particularly the jetty-ee9-osgi-boot-jsp fragment bundle that uses this facility.
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcollectFragmentsAndRequiredBundles(org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin admin, Map<String, org.osgi.framework.Bundle> deps, boolean onlyReexport) Returns the fragments and the required-bundles.protected voidcollectRequiredBundles(org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin admin, Map<String, org.osgi.framework.Bundle> deps, boolean onlyReexport) A simplistic but good enough parser for the Require-Bundle header.booleanorg.osgi.framework.Bundle[]getFragments(org.osgi.framework.Bundle bundle) Helper to access the PackageAdmin and return the fragments hosted by a bundle. when we drop the support for the older versions of OSGi, we will stop using the PackageAdmin service.org.osgi.framework.Bundle[]getFragmentsAndRequiredBundles(org.osgi.framework.Bundle bundle) Returns the fragments and the required-bundles of a bundle.voidserviceChanged(org.osgi.framework.ServiceEvent event) Invokes the optional BundleActivator in each fragment.voidstop()
- 
Field Details- 
INSTANCE
 
- 
- 
Constructor Details- 
PackageAdminServiceTracker
 
- 
- 
Method Details- 
serviceChangedpublic void serviceChanged(org.osgi.framework.ServiceEvent event) Invokes the optional BundleActivator in each fragment. By convention the bundle activator for a fragment must be in the package that is defined by the symbolic name of the fragment and the name of the class must be 'FragmentActivator'.- Specified by:
- serviceChangedin interface- org.osgi.framework.ServiceListener
- Parameters:
- event- The- ServiceEventobject.
 
- 
getFragmentspublic org.osgi.framework.Bundle[] getFragments(org.osgi.framework.Bundle bundle) Helper to access the PackageAdmin and return the fragments hosted by a bundle. when we drop the support for the older versions of OSGi, we will stop using the PackageAdmin service.- Parameters:
- bundle- the bundle
- Returns:
- the bundle fragment list
 
- 
getFragmentsAndRequiredBundlespublic org.osgi.framework.Bundle[] getFragmentsAndRequiredBundles(org.osgi.framework.Bundle bundle) Returns the fragments and the required-bundles of a bundle. Recursively collect the required-bundles and fragment when the directive visibility:=reexport is added to a required-bundle.- Parameters:
- bundle- the bundle
- Returns:
- the bundle fragment and required list
 
- 
collectFragmentsAndRequiredBundlesprotected void collectFragmentsAndRequiredBundles(org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin admin, Map<String, org.osgi.framework.Bundle> deps, boolean onlyReexport) Returns the fragments and the required-bundles. Collects them transitively when the directive 'visibility:=reexport' is added to a required-bundle.- Parameters:
- bundle- the bundle
- admin- the admin package
- deps- The map of fragment and required bundles associated to the value of the jetty-web attribute.
- onlyReexport- true to collect resources and web-fragments transitively if and only if the directive visibility is reexport.
 
- 
collectRequiredBundlesprotected void collectRequiredBundles(org.osgi.framework.Bundle bundle, org.osgi.service.packageadmin.PackageAdmin admin, Map<String, org.osgi.framework.Bundle> deps, boolean onlyReexport) A simplistic but good enough parser for the Require-Bundle header. Parses the version range attribute and the visibility directive.- Parameters:
- bundle- the bundle
- admin- the admin package
- deps- The map of required bundles associated to the value of the jetty-web attribute.
- onlyReexport- true to collect resources and web-fragments transitively if and only if the directive visibility is reexport.
 
- 
stoppublic void stop()
- 
frameworkHasCompletedAutostartspublic boolean frameworkHasCompletedAutostarts()- Returns:
- true if the framework has completed all the start levels.
 
 
-