java.lang.Objectjava.util.EventObject
javax.naming.event.NamingEvent
public class NamingEvent
This class represents an event fired by a naming/directory service.
The NamingEvent's state consists of
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:
When an object named "x/y" is subsequently deleted, the corresponding NamingEvent (evt) must contain:
NamespaceChangeListener listener = ...; src.addNamingListener("x", SUBTREE_SCOPE, listener);
Care must be taken when multiple threads are accessing the same EventContext concurrently. See the package description for more information on threading issues.
evt.getEventContext() == src evt.getOldBinding().getName().equals("x/y")
NamingListener,
EventContext,
Serialized Form| Field Summary | |
|---|---|
protected Object |
changeInfo
Contains information about the change that generated this event. |
protected Binding |
newBinding
Contains information about the object after the change. |
static int |
OBJECT_ADDED
Naming event type for indicating that a new object has been added. |
static int |
OBJECT_CHANGED
Naming event type for indicating that an object has been changed. |
static int |
OBJECT_REMOVED
Naming event type for indicating that an object has been removed. |
static 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. |
protected int |
type
Contains the type of this event. |
| Fields inherited from class java.util.EventObject |
|---|
source |
| Constructor Summary | |
|---|---|
NamingEvent(EventContext source,
int type,
Binding newBd,
Binding oldBd,
Object changeInfo)
Constructs an instance of NamingEvent. |
|
| Method Summary | |
|---|---|
void |
dispatch(NamingListener listener)
Invokes the appropriate listener method on this event. |
Object |
getChangeInfo()
Retrieves the change information for this event. |
EventContext |
getEventContext()
Retrieves the event source that fired this event. |
Binding |
getNewBinding()
Retrieves the binding of the object after the change. |
Binding |
getOldBinding()
Retrieves the binding of the object before the change. |
int |
getType()
Returns the type of this event. |
| Methods inherited from class java.util.EventObject |
|---|
getSource, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int OBJECT_ADDED
public static final int OBJECT_REMOVED
public static final int OBJECT_RENAMED
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.
public static final int OBJECT_CHANGED
The value of this constant is 3.
protected Object changeInfo
protected int type
OBJECT_ADDED,
OBJECT_REMOVED,
OBJECT_RENAMED,
OBJECT_CHANGEDprotected Binding oldBinding
protected Binding newBinding
| Constructor Detail |
|---|
public NamingEvent(EventContext source, int type, Binding newBd, Binding oldBd, Object changeInfo)
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.
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.OBJECT_ADDED,
OBJECT_REMOVED,
OBJECT_RENAMED,
OBJECT_CHANGED| Method Detail |
|---|
public int getType()
OBJECT_ADDED,
OBJECT_REMOVED,
OBJECT_RENAMED,
OBJECT_CHANGEDpublic EventContext getEventContext()
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.
public Binding getOldBinding()
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.
public Binding getNewBinding()
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.
public Object getChangeInfo()
public void dispatch(NamingListener listener)
The listener method is executed in the same thread as this method. See the package description for more information on threading issues.
listener - The nonnull listener.Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)