Framework Professional Edition Package


com.prosyst.util.event
Class BasicEvent

java.lang.Object
  extended by com.prosyst.util.event.BasicEvent

public class BasicEvent
extends java.lang.Object

Used to represent FrameworkEvents, ServiceEvents, BundleEvents and custom events at the client side.


Field Summary
static int B_INSTALLED
          A bundle has been installed.
static int B_STARTED
          A bundle has been started.
static int B_STOPPED
          A bundle has been stopped.
static int B_UNINSTALLED
          A bundle has been uninstalled.
static int B_UPDATED
          A bundle has been updated.
 byte evType
          Specifies the event's type.
static int F_DISCONNECTED
          The server has disconnected the client.
static int F_ERROR
          An error has occurred.
static int F_STARTED
          The framework has been started.
 BasicEvent next
          Should not be used by clients.
static int PACKAGES_REFRESHED
          A PackageAdmin.refreshPackage operation has completed.
static int S_MODIFIED
          The properties of a registered service have been modified.
static int S_REGISTERED
          A service has been registered.
static int S_UNREGISTERING
          A service is in the process of being unregistered.
static int STARTLEVEL_CHANGED
          A StartLevel.setStartLevel operation has completed.
 
Constructor Summary
BasicEvent()
          Constructs a BasicEvent that represents a framework event.
BasicEvent(int type)
          Constructs a BasicEvent that represents a framework event.
BasicEvent(int type, long bid)
          Constructs a BasicEvent that represents a bundle event.
BasicEvent(int type, java.lang.String[] objectClass, long bid)
          Constructs a BasicEvent that represents a service event.
BasicEvent(long bid, java.lang.String errMsg)
          Constructs a BasicEvent that represents a framework event with a related bundle and exception.
BasicEvent(java.lang.String errMsg)
          Constructs a BasicEvent that represents a framework event with a related error message.
 
Method Summary
 BasicEvent cloneEvent()
          Clones the event.
 long getBundleId()
          Returns the id of the bundle associated with this event.
 java.lang.String[] getClasses()
          Returns the object class of the service associated with this event.
 java.lang.String getErrMsg()
          Returns the error message associated with this event.
 int getType()
          Retrieves the type of this event.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

B_INSTALLED

public static final int B_INSTALLED
A bundle has been installed.

The value of B_INSTALLED is 0x00000001.

See Also:
BundleContext.installBundle(java.lang.String), Constant Field Values

B_STARTED

public static final int B_STARTED
A bundle has been started.

The value of B_STARTED is 0x00000002.

See Also:
Bundle.start(int), Constant Field Values

B_STOPPED

public static final int B_STOPPED
A bundle has been stopped.

The value of B_STOPPED is 0x00000004.

See Also:
Bundle.stop(int), Constant Field Values

B_UPDATED

public static final int B_UPDATED
A bundle has been updated.

The value of B_UPDATED is 0x00000008.

See Also:
Bundle.update(), Constant Field Values

B_UNINSTALLED

public static final int B_UNINSTALLED
A bundle has been uninstalled.

The value of B_UNINSTALLED is 0x00000010.

See Also:
Bundle.uninstall(), Constant Field Values

F_STARTED

public static final int F_STARTED
The framework has been started. This event is broadcast when the framework has been started and after all installed bundles that are marked to be started have been started.

The value of F_STARTED is 0x00000001.

See Also:
Constant Field Values

F_ERROR

public static final int F_ERROR
An error has occurred. There was an error associated with a bundle.

The value of F_ERROR is 0x00000002.

See Also:
Constant Field Values

F_DISCONNECTED

public static final int F_DISCONNECTED
The server has disconnected the client.

The value of F_DISCONNECTED is 0x00000010.

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

S_REGISTERED

public static final int S_REGISTERED
A service has been registered. This event is synchronously delivered AFTER the service has been registered.

The value of S_REGISTERED is 0x00000001.

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

S_MODIFIED

public static final int S_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 S_MODIFIED is 0x00000002.

See Also:
ServiceRegistration.setProperties(java.util.Dictionary), Constant Field Values

S_UNREGISTERING

public static final int S_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, this 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 S_UNREGISTERING is 0x00000004.

See Also:
ServiceRegistration.unregister(), BundleContext.ungetService(org.osgi.framework.ServiceReference), Constant Field Values

evType

public byte evType
Specifies the event's type. Values are: 1 for bundle, 2 for service. 3 for framework and 4 for custom event.


next

public BasicEvent next
Should not be used by clients.

Constructor Detail

BasicEvent

public BasicEvent(int type,
                  long bid)
Constructs a BasicEvent that represents a bundle event.

Parameters:
type - the event type
bid - the id of the bundle with a change in it's lifecycle

BasicEvent

public BasicEvent(long bid,
                  java.lang.String errMsg)
Constructs a BasicEvent that represents a framework event with a related bundle and exception. This constructor is used for framework events of type F_ERROR.

Parameters:
bid - the id of the related bundle
errMsg - the message of the related exception

BasicEvent

public BasicEvent(java.lang.String errMsg)
Constructs a BasicEvent that represents a framework event with a related error message. This constructor is used for framework events of type F_DISCONNECTED.

Parameters:
errMsg - the message of the related exception

BasicEvent

public BasicEvent()
Constructs a BasicEvent that represents a framework event. This constructor is used for framework events of type F_STARTED.


BasicEvent

public BasicEvent(int type)
Constructs a BasicEvent that represents a framework event.


BasicEvent

public BasicEvent(int type,
                  java.lang.String[] objectClass,
                  long bid)
Constructs a BasicEvent that represents a service event.

Parameters:
type - the event type
objectClass - the names of the interfaces under which the service that generated the event has been registered.
Method Detail

getType

public int getType()
Retrieves the type of this event. The type values are B_INSTALLED, B_STARTED, B_STOPPED, B_UPDATED, B_UNINSTALLED, F_STARTED, F_ERROR, S_REGISTERED, S_MODIFIED, S_UNREGISTERING.

Returns:
the type of bundle lifecycle change

getBundleId

public long getBundleId()
Returns the id of the bundle associated with this event. Used if type = B_INSTALLED, B_STARTED, B_STOPPED, B_UPDATED, B_UNINSTALLED.


getErrMsg

public java.lang.String getErrMsg()
Returns the error message associated with this event. Used if type = F_ERROR, F_DISCONNECTED.


getClasses

public java.lang.String[] getClasses()
Returns the object class of the service associated with this event. Used if type = S_REGISTERED, S_MODIFIED, S_UNREGISTERING.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

cloneEvent

public BasicEvent cloneEvent()
Clones the event.

Returns:
A new instance of BasicEvent initialized with the same field values.

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved