org.osgi.framework
Class FrameworkEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.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.

Version:
$Revision: 1.1 $
Author:
Open Services Gateway Initiative
See Also:
Serialized Form

Field Summary
static int ERROR
          An error has occurred.
static int PACKAGES_REFRESHED
          A PackageAdmin.refreshPackage operation has completed.
static int STARTED
          The Framework has started.
static int STARTLEVEL_CHANGED
          A StartLevel.setStartLevel operation has completed.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
FrameworkEvent(int type, Bundle bundle, java.lang.Throwable throwable)
          Creates a Framework event regarding the specified bundle.
FrameworkEvent(int type, java.lang.Object source)
          Deprecated. Since 1.2. This constructor is deprecated in favor of using the other constructor with the System Bundle as the event source.
 
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 and the Framework has reached the intitial start level.

The value of STARTED is 0x00000001.

See Also:
StartLevel, 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

PACKAGES_REFRESHED

public static final int PACKAGES_REFRESHED
A PackageAdmin.refreshPackage operation has completed.

This event is broadcast when the Framework has completed the refresh packages operation initiated by a call to the PackageAdmin.refreshPackages method.

The value of PACKAGES_REFRESHED is 0x00000004.

Since:
1.2
See Also:
PackageAdmin.refreshPackages(org.osgi.framework.Bundle[]), Constant Field Values

STARTLEVEL_CHANGED

public static final int STARTLEVEL_CHANGED
A StartLevel.setStartLevel operation has completed.

This event is broadcast when the Framework has completed changing the active start level initiated by a call to the StartLevel.setStartLevel method.

The value of STARTLEVEL_CHANGED is 0x00000008.

Since:
1.2
See Also:
StartLevel, Constant Field Values
Constructor Detail

FrameworkEvent

public FrameworkEvent(int type,
                      java.lang.Object source)
Deprecated. Since 1.2. This constructor is deprecated in favor of using the other constructor with the System Bundle as the event source.

Creates a Framework event.

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 regarding the specified bundle.

Parameters:
type - The event type.
bundle - The event source.
throwable - The related exception. This argument may be null if there is no related exception.
Method Detail

getThrowable

public final 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 final Bundle getBundle()
Returns the bundle associated with the event. This bundle is also the source of the event.

Returns:
The bundle associated with the event.

getType

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

The type values are:

Returns:
The type of state change.


Copyright © 2009 IKS, ETH Zurich. All Rights Reserved.