OSGi™ Service Platform
Release 2

org.osgi.framework
Class FrameworkEvent

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

public class FrameworkEvent
extends java.util.EventObject

A general Framework event.

FrameworkEvent is the event class used when notifying listeners of general events occuring within the OSGI environment. A type code is used to identify the event type for future extendability.

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

See Also:
Serialized Form

Field Summary
static int ERROR
          An error has occurred.
static int STARTED
          The Framework has started.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
FrameworkEvent(int type, Bundle bundle, java.lang.Throwable throwable)
          Creates a Framework event with a related bundle and exception.
FrameworkEvent(int type, java.lang.Object source)
          Creates a Framework event.
 
Method Summary
 Bundle getBundle()
          Returns the bundle associated with the event.
 java.lang.Throwable getThrowable()
          Returns the exception associated with the event.
 int getType()
          Returns the type of bundle state change.
 
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

STARTED

public static final int STARTED
The Framework has started.

This event is broadcast when the Framework has started after all installed bundles that are marked to be started have been started.

The value of STARTED is 0x00000001.

See Also:
Constant Field Values

ERROR

public static final int ERROR
An error has occurred.

There was an error associated with a bundle.

The value of ERROR is 0x00000002.

See Also:
Constant Field Values
Constructor Detail

FrameworkEvent

public FrameworkEvent(int type,
                      java.lang.Object source)
Creates a Framework event.

This constructor is used for Framework events of type STARTED.

Parameters:
type - The event type.
source - The event source object. This may not be null.

FrameworkEvent

public FrameworkEvent(int type,
                      Bundle bundle,
                      java.lang.Throwable throwable)
Creates a Framework event with a related bundle and exception.

This constructor is used for Framework events of type ERROR.

Parameters:
type - The event type.
bundle - The related bundle.
throwable - The related exception.
Method Detail

getThrowable

public java.lang.Throwable getThrowable()
Returns the exception associated with the event.

If the event type is ERROR, this method returns the exception related to the error.

Returns:
An exception if an event of type ERROR or null.

getBundle

public Bundle getBundle()
Returns the bundle associated with the event.

If the event type is ERROR, this metod returns the bundle related to the error. This bundle is also the source of the event.

Returns:
A bundle if an event of type ERROR or null.

getType

public int getType()
Returns the type of bundle state change.

The type values are:

Returns:
The type of state change.

OSGi™ Service Platform
Release 2

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