Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| OSGi Service Platform Release 3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.osgi.framework
Class ServiceEvent

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

All Implemented Interfaces:
  java.io.Serializable

public class ServiceEvent
extends java.util.EventObject

A service lifecycle change event.

`ServiceEvent` objects are delivered to a `ServiceListener` objects when a change occurs in this service's lifecycle. A type code is used to identify the event type for future extendability.

OSGi reserves the right to extend the set of types.

See Also:
  `ServiceListener`, Serialized Form

Field Summary
`static int` | `MODIFIED` The properties of a registered service have been modified.
`static int` | `REGISTERED` This service has been registered.
`static int` | `UNREGISTERING` This service is in the process of being unregistered.

Fields inherited from class java.util.EventObject
`source`

Constructor Summary
`ServiceEvent(int type, ServiceReference reference)` Creates a new service event object.

Method Summary
`ServiceReference` | `getServiceReference()` Returns a reference to the service that had a change occur in its lifecycle.
`int` | `getType()` Returns the type of event.

Methods inherited from class java.util.EventObject
`getSource, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### REGISTERED

    public static final int REGISTERED

  This service has been registered.

  This event is synchronously delivered after the service has been registered with the Framework.

  The value of `REGISTERED` is 0x00000001.

  See Also:
    `BundleContext.registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)`

### 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(java.util.Dictionary)`

### UNREGISTERING

    public static final int UNREGISTERING

  This 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 the service unregistration operation.

  The value of UNREGISTERING is 0x00000004.

  See Also:
    `ServiceRegistration.unregister()`, `BundleContext.ungetService(org.osgi.framework.ServiceReference)`

Constructor Detail

### ServiceEvent

    public ServiceEvent(int type,
                        ServiceReference reference)

  Creates a new service event object.
  Parameters:
    `type` - The event type.
    `reference` - A `ServiceReference` object to the service that had a lifecycle change.

Method Detail

### getServiceReference

    public ServiceReference getServiceReference()

  Returns a reference to the service that had a change occur in its lifecycle.

  This reference is the source of the event.

  Returns:
    Reference to the service that had a lifecycle change.

### getType

    public int getType()

  Returns the type of event. The event type values are:
  - `REGISTERED`
  - `MODIFIED`
  - `UNREGISTERING`
  Returns:
    Type of service lifecycle change.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| OSGi Service Platform Release 3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) OSGi Alliance (2000, 2003). All Rights Reserved.