The NamingEvent's state consists of
EventContext which fired this event.
Note that the event source is always the same EventContext
instance that the listener has registered with.
Furthermore, the names of the bindings in
the NamingEvent are always relative to that instance.
For example, suppose a listener makes the following registration:
NamespaceChangeListener listener = ...;
src.addNamingListener("x", SUBTREE_SCOPE, listener);
When an object named "x/y" is subsequently deleted, the corresponding
NamingEvent (evt) must contain:
evt.getEventContext() == src
evt.getOldBinding().getName().equals("x/y")
Care must be taken when multiple threads are accessing the same
EventContext concurrently.
See the
package description
for more information on threading issues.
NamingListener, EventContext
| Modifier and Type | Field and Description |
|---|---|
| protected Object | changeInfo
Contains information about the change that generated this event. |
| protected Binding | newBinding
Contains information about the object after the change. |
| public static final int | OBJECT_ADDED
Naming event type for indicating that a new object has been added. |
| public static final int | OBJECT_CHANGED
Naming event type for indicating that an object has been changed. |
| public static final int | OBJECT_REMOVED
Naming event type for indicating that an object has been removed. |
| public static final int | OBJECT_RENAMED
Naming event type for indicating that an object has been renamed. |
| protected Binding | oldBinding
Contains information about the object before the change. |
| private static final long | |
| protected int | type
Contains the type of this event. |
| Access | Constructor and Description |
|---|---|
| public | NamingEvent(EventContext
The non-null context that fired this event. source, int The type of the event. type, Binding A possibly null binding before the change. See method description. newBd, Binding A possibly null binding after the change. See method description. oldBd, Object A possibly null object containing information about the change. changeInfo)Constructs an instance of |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispatch(NamingListener
The nonnull listener. listener)Invokes the appropriate listener method on this event. |
| public Object | Returns: The possibly null change information of this event.Retrieves the change information for this event. |
| public EventContext | Returns: The non-null context that fired this event.Retrieves the event source that fired this event. |
| public Binding | Returns: The possibly null binding of the object after the change.Retrieves the binding of the object after the change. |
| public Binding | Returns: The possibly null binding of the object before the change.Retrieves the binding of the object before the change. |
| public int |
| changeInfo | back to summary |
|---|---|
| protected Object changeInfo Contains information about the change that generated this event.
| |
| newBinding | back to summary |
|---|---|
| protected Binding newBinding Contains information about the object after the change. | |
| OBJECT_ADDED | back to summary |
|---|---|
| public static final int OBJECT_ADDED Naming event type for indicating that a new object has been added.
The value of this constant is | |
| OBJECT_CHANGED | back to summary |
|---|---|
| public static final int OBJECT_CHANGED Naming event type for indicating that an object has been changed. The changes might include the object's attributes, or the object itself. Note that some services might fire multiple events for a single modification. For example, the modification might be implemented by first removing the old binding and adding a new binding containing the same name but a different object.
The value of this constant is | |
| OBJECT_REMOVED | back to summary |
|---|---|
| public static final int OBJECT_REMOVED Naming event type for indicating that an object has been removed.
The value of this constant is | |
| OBJECT_RENAMED | back to summary |
|---|---|
| public static final int OBJECT_RENAMED Naming event type for indicating that an object has been renamed. Note that some services might fire multiple events for a single logical rename operation. For example, the rename operation might be implemented by adding a binding with the new name and removing the old binding.
The old/new binding in When an interior node in the namespace tree has been renamed, the topmost node which is part of the listener's scope should used to generate a rename event. The extent to which this can be supported is provider-specific. For example, a service might generate rename notifications for all descendants of the changed interior node and the corresponding provider might not be able to prevent those notifications from being propagated to the listeners.
The value of this constant is | |
| oldBinding | back to summary |
|---|---|
| protected Binding oldBinding Contains information about the object before the change. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| type | back to summary |
|---|---|
| protected int type Contains the type of this event.
| |
| NamingEvent | back to summary |
|---|---|
| public NamingEvent(EventContext source, int type, Binding newBd, Binding oldBd, Object changeInfo) Constructs an instance of
The names in
| |
| dispatch | back to summary |
|---|---|
| public void dispatch(NamingListener listener) Invokes the appropriate listener method on this event.
The default implementation of
this method handles the following event types:
The listener method is executed in the same thread as this method. See the package description for more information on threading issues.
| |
| getChangeInfo | back to summary |
|---|---|
| public Object getChangeInfo() Retrieves the change information for this event. The value of the change information is service-specific. For example, it could be an ID that identifies the change in a change log on the server.
| |
| getEventContext | back to summary |
|---|---|
| public EventContext getEventContext() Retrieves the event source that fired this event.
This returns the same object as
If the result of this method is used to access the
event source, for example, to look up the object or get its attributes,
then it needs to be locked because implementations of
| |
| getNewBinding | back to summary |
|---|---|
| public Binding getNewBinding() Retrieves the binding of the object after the change.
The binding must be nonnull if the object existed after the change
relative to the source context (
The name in the binding is to be resolved relative
to the event source
| |
| getOldBinding | back to summary |
|---|---|
| public Binding getOldBinding() Retrieves the binding of the object before the change.
The binding must be nonnull if the object existed before the change
relative to the source context (
The name in the binding is to be resolved relative
to the event source
| |
| getType | back to summary |
|---|---|
| public int getType() Returns the type of this event.
| |