public void bundleChanged(BundleEvent bundleEvent) {
        final String topic = getTopic(bundleEvent);

        // Bail quickly if the event is one that should be ignored
        if (topic == null) {
            return;
        }

        // Event properties
        Map<String, Object> eventProperties = new HashMap<String, Object>();

        // "event" --> the original event object
        eventProperties.put(EventConstants.EVENT, bundleEvent);

        // Non-null result from getBundle
        // "bundle.id" --> source bundle id as Long
        // "bundle.symbolicName" --> source bundle's symbolic name
        // "bundle" --> the source bundle object
        Bundle bundle = bundleEvent.getBundle();
        if (bundle != null) {
            eventProperties.put(EventConstants.BUNDLE_ID, Long.valueOf(bundle.getBundleId()));
            String symbolicName = bundle.getSymbolicName();
            if (symbolicName != null) {
                eventProperties.put(EventConstants.BUNDLE_SYMBOLICNAME, symbolicName);
            }
            eventProperties.put(EventConstants.BUNDLE, bundle);
        }

        // Construct and fire the event
        Event event = new Event(topic, eventProperties);
        eventAdmin.postEvent(event);
    }
public void bundleChanged ( BundleEvent bundleEvent ) { final String topic = getTopic ( bundleEvent ) ; if ( topic == null ) { return ; } Map < String , Object > eventProperties = new HashMap < String , Object > ( ) ; eventProperties . put ( EventConstants . EVENT , bundleEvent ) ; Bundle bundle = bundleEvent . getBundle ( ) ; if ( bundle != null ) { eventProperties . put ( EventConstants . BUNDLE_ID , Long . valueOf ( bundle . getBundleId ( ) ) ) ; String symbolicName = bundle . getSymbolicName ( ) ; if ( symbolicName != null ) { eventProperties . put ( EventConstants . BUNDLE_SYMBOLICNAME , symbolicName ) ; } eventProperties . put ( EventConstants . BUNDLE , bundle ) ; } Event event = new Event ( topic , eventProperties ) ; eventAdmin . postEvent ( event ) ; }
Receive notification of a bundle lifecycle change event and adapt it to
the format required for the <code>EventAdmin</code> service.

@param bundleEvent
the bundle lifecycle event to publish as an <code>Event</code>