ServiceEvent

Syntax

public class ServiceEvent extends java.util.EventObject

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.osgi.framework.ServiceEvent
					

All Implemented Interfaces: java.io.Serializable

Description

Service life cycle change event. ServiceEvents are delivered to ServiceListeners when a change occurs in the service's life cycle. A type code is used to identify the event for future extendability.

OSGi reserves the right to extend the set of types in the future.

Member Summary
Fields
public static finalMODIFIED
 The properties of a registered service have been modified.
public static finalREGISTERED
 A service has been registered.
public static finalUNREGISTERING
 A service is in the process of being unregistered.
Constructors
publicServiceEvent(int, ServiceReference)
 Construct a service event.
Methods
public ServiceReference getServiceReference()
 Retrieve a reference to the service who had a change occur in its life cycle.
public intgetType()
 Retrieve the type of this event.

Fields

MODIFIED
public static final int MODIFIED
						

The properties of a registered service have been modified. This event is synchronously delivered AFTER the service properties have been modified.

The value of MODIFIED is 0x00000002.

See Also: ServiceRegistration.setProperties(Dictionary)

REGISTERED
public static final int REGISTERED
						

A service has been registered. This event is synchronously delivered AFTER the service has been registered.

The value of REGISTERED is 0x00000001.

See Also: BundleContext.registerService(String[], Object, Dictionary)

UNREGISTERING
public static final int UNREGISTERING
						

A service is in the process of being unregistered. This event is synchronously delivered BEFORE the service has completed unregistering.

If a bundle is using a service that is UNREGISTERING, the bundle should release its use of the service when it receives this event. If the bundle does not release its use of the service when it receives this event, the framework will automatically release the bundle's use of the service while completing unregistering the service.

The value of UNREGISTERING is 0x00000004.

See Also: ServiceRegistration.unregister(), BundleContext.ungetService(ServiceReference)

Constructors

ServiceEvent(int, ServiceReference)
public ServiceEvent(int type, ServiceReference reference)

Construct a service event.

Parameters:

type— The event type.

reference— A ServiceReference to the service who had a change occur in its life cycle.

Methods

getServiceReference()
public ServiceReference getServiceReference()

Retrieve a reference to the service who had a change occur in its life cycle. This reference is the source of the event.

Returns: A reference to the service who had a change occur in its life cycle.

getType()
public int getType()

Retrieve the type of this event. The type values are REGISTERED, MODIFIED, UNREGISTERING.

Returns: The type of service life cycle change.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.36.146