- All Implemented Interfaces:
- Serializable
 The NamingEvent's state consists of
 
- The event source: the EventContextwhich fired this event.
- The event type.
- The new binding: information about the object after the change.
- The old binding: information about the object before the change.
- Change information: information about the change that triggered this event; usually service provider-specific or server-specific information.
 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);
NamingEvent (evt) must contain:
     evt.getEventContext() == src
     evt.getOldBinding().getName().equals("x/y")
EventContext concurrently.
 See the
 package description
 for more information on threading issues.- Since:
- 1.3
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected ObjectContains information about the change that generated this event.protected BindingContains information about the object after the change.static final intNaming event type for indicating that a new object has been added.static final intNaming event type for indicating that an object has been changed.static final intNaming event type for indicating that an object has been removed.static final intNaming event type for indicating that an object has been renamed.protected BindingContains information about the object before the change.protected intContains the type of this event.Fields declared in class java.util.EventObjectsource
- 
Constructor SummaryConstructorsConstructorDescriptionNamingEvent(EventContext source, int type, Binding newBd, Binding oldBd, Object changeInfo) Constructs an instance ofNamingEvent.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispatch(NamingListener listener) Invokes the appropriate listener method on this event.Retrieves the change information for this event.Retrieves the event source that fired this event.Retrieves the binding of the object after the change.Retrieves the binding of the object before the change.intgetType()Returns the type of this event.Methods declared in class java.util.EventObjectgetSource, toString
- 
Field Details- 
OBJECT_ADDEDpublic static final int OBJECT_ADDEDNaming event type for indicating that a new object has been added. The value of this constant is0.- See Also:
 
- 
OBJECT_REMOVEDpublic static final int OBJECT_REMOVEDNaming event type for indicating that an object has been removed. The value of this constant is1.- See Also:
 
- 
OBJECT_RENAMEDpublic static final int OBJECT_RENAMEDNaming 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 NamingEventmay be null if the old name or new name is outside of the scope for which the listener has registered.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 2.- See Also:
 
- 
OBJECT_CHANGEDpublic static final int OBJECT_CHANGEDNaming 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 3.- See Also:
 
- 
changeInfoContains information about the change that generated this event.
- 
typeprotected int typeContains the type of this event.- See Also:
 
- 
oldBindingContains information about the object before the change.
- 
newBindingContains information about the object after the change.
 
- 
- 
Constructor Details- 
NamingEventConstructs an instance ofNamingEvent.The names in newBdandoldBdare to be resolved relative to the event sourcesource. For anOBJECT_ADDEDevent type,newBdmust not be null. For anOBJECT_REMOVEDevent type,oldBdmust not be null. For anOBJECT_CHANGEDevent type,newBdandoldBdmust not be null. For anOBJECT_RENAMEDevent type, one ofnewBdoroldBdmay be null if the new or old binding is outside of the scope for which the listener has registered.- Parameters:
- source- The non-null context that fired this event.
- type- The type of the event.
- newBd- A possibly null binding before the change. See method description.
- oldBd- A possibly null binding after the change. See method description.
- changeInfo- A possibly null object containing information about the change.
- See Also:
 
 
- 
- 
Method Details- 
getTypepublic int getType()Returns the type of this event.- Returns:
- The type of this event.
- See Also:
 
- 
getEventContextRetrieves the event source that fired this event. This returns the same object asEventObject.getSource().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 Contextare not guaranteed to be thread-safe (andEventContextis a subinterface ofContext). See the package description for more information on threading issues.- Returns:
- The non-null context that fired this event.
 
- 
getOldBindingRetrieves 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 ( getEventContext()). That is, it must be nonnull forOBJECT_REMOVEDandOBJECT_CHANGED. ForOBJECT_RENAMED, it is null if the object before the rename is outside of the scope for which the listener has registered interest; it is nonnull if the object is inside the scope before the rename.The name in the binding is to be resolved relative to the event source getEventContext(). The object returned byBinding.getObject()may be null if such information is unavailable.- Returns:
- The possibly null binding of the object before the change.
 
- 
getNewBindingRetrieves 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 ( getEventContext()). That is, it must be nonnull forOBJECT_ADDEDandOBJECT_CHANGED. ForOBJECT_RENAMED, it is null if the object after the rename is outside the scope for which the listener registered interest; it is nonnull if the object is inside the scope after the rename.The name in the binding is to be resolved relative to the event source getEventContext(). The object returned byBinding.getObject()may be null if such information is unavailable.- Returns:
- The possibly null binding of the object after the change.
 
- 
getChangeInfoRetrieves 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.- Returns:
- The possibly null change information of this event.
 
- 
dispatchInvokes the appropriate listener method on this event. The default implementation of this method handles the following event types:OBJECT_ADDED, OBJECT_REMOVED, OBJECT_RENAMED, OBJECT_CHANGED.The listener method is executed in the same thread as this method. See the package description for more information on threading issues. - Parameters:
- listener- The nonnull listener.
 
 
-