Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 3. Design Patterns for Developing M-Beans[ Fast Forward ][ Next ]

Event Sources

The JavaBeans component model defines design patterns for:

Multicast Event Sources

By default, the following design pattern is used to define which multicast events an m-bean can send:
public void addEventListenerType(EventListenerType a);
public removeEventListenerType(EventListenerType a);

Both the methods take the same EventListenerType type argument. EventListenerType is a Java interface which conforms to the following rules:

This design pattern assumes that the m-bean is a multicast event source for the events specified in the EventListenerType interface.

Example 3-4 defines a multicast event source.

Example 3-4. A Simple Listener
public void addFredListener(FredListener a);
public void removeFredListener(FredListener a);

Unicast Event Sources

By default, the following design pattern is used to define which unicast events an m-bean can send:
public void addEventListenerType(EventListenerType a)
	throws java.util.TooManyListenersException;
public removeEventListenerType(EventListenerType a);

These design patterns are the same as those defined in Multicast Event Sources, except that the signature of the addEventListenerType() method includes the clause throws java.util.TooManyListenersException. This exception is thrown if the addEventListenerType() method is invoked when a listener is already registered.

Both the methods take the same EventListenerType type argument. This design pattern assumes that the m-bean is a unicast event source for the events specified in the EventListenerType interface.


[ Previous ][ Home ][ Next ]
Properties[ Up ]Initializing and Deleting an M-Bean