Previous | Next | Trail Map | Getting Started | JNDI Overview

Event Package

The javax.naming.event(in the API reference documentation) package contains classes and interfaces for supporting event notification in naming and directory services. Event notification is described in detail in the Beyond the Basics (in the Beyond the Basics trail) trail.

Events

A NamingEvent(in the API reference documentation) represents an event that is generated by a naming/directory service. The event contains a type that identifies the type of event. For example, event types are categorized into those that affect the namespace, such as "object added," and those that do not, such as "object changed." A NamingEvent also contains other information about the change, such as information about the object before and after the change.

Listeners

A NamingListener(in the API reference documentation) is an object that listens for NamingEvents. Each category of event type has a corresponding type of NamingListener. For example, a NamespaceChangeListener(in the API reference documentation) represents a listener interested in namespace change events and an ObjectChangeListener(in the API reference documentation) represents a listener interested in object change events.

To receive event notifications, a listener must be registered with either an EventContext(in the API reference documentation) or an EventDirContext(in the API reference documentation). Once registered, the listener will receive event notifications when the corresponding changes occur in the naming/directory service.


Previous | Next | Trail Map | Getting Started | JNDI Overview