Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 4. Operations on M-Beans | ![]() | ![]() |
Every time an m-bean is registered or deleted from the repository, the framework generates an event of the com.sun.jaw.reference.agent.cmf.FrameworkEvent class. Two static fields of this class define the types of events that the framework generates:
CREATE_EVT, sent when objects are registered
DELETE_EVT, sent when objects are unregistered
As described in Operations on an Agent in Chapter 7, it is also possible to create, register and delete m-beans from remote management applications. Events are always generated for m-bean registrations or deletions, regardless of the source of the operation. However, the information transmitted with the event does not identify the object, local or remote, which requested the operation.
Framework events are automatically sent to all listeners, who must implement the com.sun.jaw.reference.agent.cmf.FrameworkListener abstract interface. Two methods of the Framework class allow objects to add or remove themselves from the list of listeners:
void addFrameworkListener( FrameworkListener l )
void removeFrameworkListener( FrameworkListener l )
To optimize event communication, a single event object can signal the creation or deletion of several m-beans. However, the same operation applies to all m-beans listed in an event object. When a listener is notified of a newly generated framework event, the listener can call either of the event object's methods:
Integer getEventType() returns one of the two static values to identify the event as either m-bean registration or deletion
Vector getEventObjectNames() returns a vector of object names that lists all objects concerned by the event
Since the framework is also an m-bean, it can be managed remotely. The Java Dynamic Management Kit provides the mechanisms for adding and removing framework event listeners within management applications connected to an agent. See Event Handling Service in Chapter 15 for more information about how to setup and receive events remotely through adaptors.
![]() | ![]() | ![]() |
Deleting M-Beans | ![]() | Retrieving M-Beans |