OSGi™ Service Platform
Release 4 Version 4.1

org.osgi.application
Class ApplicationServiceEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.osgi.framework.ServiceEvent
          extended byorg.osgi.application.ApplicationServiceEvent
All Implemented Interfaces:
java.io.Serializable

public class ApplicationServiceEvent
extends ServiceEvent

An event from the Framework describing a service lifecycle change.

ApplicationServiceEvent objects are delivered to a ApplicationServiceListener objects when a change occurs in this service's lifecycle. The delivery of an ApplicationServiceEvent is always triggered by a ServiceEvent. ApplicationServiceEvent extends the content of ServiceEvent with the service object the event is referring to as applications has no means to find the corresponding service object for a ServiceReference. A type code is used to identify the event type for future extendability. The available type codes are defined in ServiceEvent.

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

See Also:
ServiceEvent, ApplicationServiceListener, Serialized Form

Field Summary
 
Fields inherited from class org.osgi.framework.ServiceEvent
MODIFIED, REGISTERED, UNREGISTERING
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ApplicationServiceEvent(int type, ServiceReference reference, java.lang.Object serviceObject)
          Creates a new application service event object.
 
Method Summary
 java.lang.Object getServiceObject()
          This method returns the service object of this service bound to the listener application instace.
 
Methods inherited from class org.osgi.framework.ServiceEvent
getServiceReference, getType
 
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
 

Constructor Detail

ApplicationServiceEvent

public ApplicationServiceEvent(int type,
                               ServiceReference reference,
                               java.lang.Object serviceObject)
Creates a new application service event object.

Parameters:
type - The event type. Available type codes are defines in ServiceEvent
reference - A ServiceReference object to the service that had a lifecycle change. This reference will be used as the source in the EventObject baseclass, therefore, it must not be null.
serviceObject - The service object bound to this application instance. It can be null if this application is not bound to this service yet.
Throws:
java.lang.IllegalArgumentException - if the specified reference is null.
Method Detail

getServiceObject

public java.lang.Object getServiceObject()
This method returns the service object of this service bound to the listener application instace. A service object becomes bound to the application when it first obtains a service object reference to that service by calling the ApplicationContext.locateService or locateServices methods. If the application is not bound to the service yet, this method returns null.

Returns:
the service object bound to the listener application or null if it isn't bound to this service yet.

OSGi™ Service Platform
Release 4 Version 4.1

Copyright © OSGi Alliance (2000, 2007). All Rights Reserved. Licensed under the OSGi Specification License, Version 1.0