Class BundleEvent

  • All Implemented Interfaces:
    Serializable

    public class BundleEvent
    extends EventObject
    An event from the Framework describing a bundle lifecycle change.

    BundleEvent objects are delivered to SynchronousBundleListeners and BundleListeners when a change occurs in a bundle's lifecycle. A type code is used to identify the event type for future extendability.

    OSGi Alliance reserves the right to extend the set of types.

    See Also:
    BundleListener, SynchronousBundleListener, Serialized Form
    • Constructor Detail

      • BundleEvent

        public BundleEvent​(int type,
                           Bundle bundle,
                           Bundle origin)
        Creates a bundle event of the specified type.
        Parameters:
        type - The event type.
        bundle - The bundle which had a lifecycle change.
        origin - The bundle which is the origin of the event. For the event type INSTALLED, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.
        Since:
        1.6
      • BundleEvent

        public BundleEvent​(int type,
                           Bundle bundle)
        Creates a bundle event of the specified type.
        Parameters:
        type - The event type.
        bundle - The bundle which had a lifecycle change. This bundle is used as the origin of the event.
    • Method Detail

      • getBundle

        public Bundle getBundle()
        Returns the bundle which had a lifecycle change. This bundle is the source of the event.
        Returns:
        The bundle that had a change occur in its lifecycle.
      • getOrigin

        public Bundle getOrigin()
        Returns the bundle that was the origin of the event.

        For the event type INSTALLED, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.

        Returns:
        The bundle that was the origin of the event.
        Since:
        1.6