Java Doc for NamingEvent.java in  » 6.0-JDK-Core » naming » javax » naming » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » naming » javax.naming.event 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.EventObject
      javax.naming.event.NamingEvent

NamingEvent
public class NamingEvent extends java.util.EventObject (Code)
This class represents an event fired by a naming/directory service.

The NamingEvent's state consists of

  • The event source: the EventContext which 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);
 
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.
author:
   Rosanna Lee
author:
   Scott Seligman
version:
   1.17 07/05/05
See Also:   NamingListener
See Also:   EventContext
since:
   1.3


Field Summary
final public static  intOBJECT_ADDED
     Naming event type for indicating that a new object has been added.
final public static  intOBJECT_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.
final public static  intOBJECT_REMOVED
     Naming event type for indicating that an object has been removed.
final public static  intOBJECT_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.
protected  ObjectchangeInfo
     Contains information about the change that generated this event.
protected  BindingnewBinding
     Contains information about the object after the change.
protected  BindingoldBinding
     Contains information about the object before the change.
protected  inttype
     Contains the type of this event.

Constructor Summary
public  NamingEvent(EventContext source, int type, Binding newBd, Binding oldBd, Object changeInfo)
     Constructs an instance of NamingEvent.

The names in newBd and oldBd are to be resolved relative to the event source source. For an OBJECT_ADDED event type, newBd must not be null. For an OBJECT_REMOVED event type, oldBd must not be null. For an OBJECT_CHANGED event type, newBd and oldBd must not be null.


Method Summary
public  voiddispatch(NamingListener listener)
     Invokes 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.

public  ObjectgetChangeInfo()
     Retrieves the change information for this event. The value of the change information is service-specific.
public  EventContextgetEventContext()
     Retrieves the event source that fired this event.
public  BindinggetNewBinding()
     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 (getEventContext()). That is, it must be nonnull for OBJECT_ADDED and OBJECT_CHANGED.

public  BindinggetOldBinding()
     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 (getEventContext()). That is, it must be nonnull for OBJECT_REMOVED and OBJECT_CHANGED. For OBJECT_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 by Binding.getObject() may be null if such information is unavailable. The possibly null binding of the object before the change.

public  intgetType()
     Returns the type of this event.

Field Detail
OBJECT_ADDED
final public static int OBJECT_ADDED(Code)
Naming event type for indicating that a new object has been added. The value of this constant is 0.



OBJECT_CHANGED
final public static int OBJECT_CHANGED(Code)
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 3.




OBJECT_REMOVED
final public static int OBJECT_REMOVED(Code)
Naming event type for indicating that an object has been removed. The value of this constant is 1.



OBJECT_RENAMED
final public static int OBJECT_RENAMED(Code)
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 NamingEvent may 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.




changeInfo
protected Object changeInfo(Code)
Contains information about the change that generated this event.



newBinding
protected Binding newBinding(Code)
Contains information about the object after the change.



oldBinding
protected Binding oldBinding(Code)
Contains information about the object before the change.



type
protected int type(Code)
Contains the type of this event.
See Also:   NamingEvent.OBJECT_ADDED
See Also:   NamingEvent.OBJECT_REMOVED
See Also:   NamingEvent.OBJECT_RENAMED
See Also:   NamingEvent.OBJECT_CHANGED




Constructor Detail
NamingEvent
public NamingEvent(EventContext source, int type, Binding newBd, Binding oldBd, Object changeInfo)(Code)
Constructs an instance of NamingEvent.

The names in newBd and oldBd are to be resolved relative to the event source source. For an OBJECT_ADDED event type, newBd must not be null. For an OBJECT_REMOVED event type, oldBd must not be null. For an OBJECT_CHANGED event type, newBd and oldBd must not be null. For an OBJECT_RENAMED event type, one of newBd or oldBd may 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.
Parameters:
  type - The type of the event.
Parameters:
  newBd - A possibly null binding before the change. See method description.
Parameters:
  oldBd - A possibly null binding after the change. See method description.
Parameters:
  changeInfo - A possibly null object containing information about the change.
See Also:   NamingEvent.OBJECT_ADDED
See Also:   NamingEvent.OBJECT_REMOVED
See Also:   NamingEvent.OBJECT_RENAMED
See Also:   NamingEvent.OBJECT_CHANGED





Method Detail
dispatch
public void dispatch(NamingListener listener)(Code)
Invokes 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.




getChangeInfo
public Object getChangeInfo()(Code)
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. The possibly null change information of this event.



getEventContext
public EventContext getEventContext()(Code)
Retrieves the event source that fired this event. This returns the same object as EventObject.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 Context are not guaranteed to be thread-safe (and EventContext is a subinterface of Context). See the package description for more information on threading issues. The non-null context that fired this event.




getNewBinding
public Binding getNewBinding()(Code)
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 (getEventContext()). That is, it must be nonnull for OBJECT_ADDED and OBJECT_CHANGED. For OBJECT_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 by Binding.getObject() may be null if such information is unavailable. The possibly null binding of the object after the change.




getOldBinding
public Binding getOldBinding()(Code)
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 (getEventContext()). That is, it must be nonnull for OBJECT_REMOVED and OBJECT_CHANGED. For OBJECT_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 by Binding.getObject() may be null if such information is unavailable. The possibly null binding of the object before the change.




getType
public int getType()(Code)
Returns the type of this event. The type of this event.
See Also:   NamingEvent.OBJECT_ADDED
See Also:   NamingEvent.OBJECT_REMOVED
See Also:   NamingEvent.OBJECT_RENAMED
See Also:   NamingEvent.OBJECT_CHANGED



Fields inherited from java.util.EventObject
protected transient Object source(Code)(Java Doc)

Methods inherited from java.util.EventObject
public Object getSource()(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.