1 /* Copyright (C) 2001 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 package javax
.naming
.event
;
10 import javax
.naming
.*;
11 import java
.util
.EventObject
;
14 * @author Warren Levy <warrenl@redhat.com>
18 public class NamingEvent
extends EventObject
20 public static final int OBJECT_ADDED
= 0;
21 public static final int OBJECT_REMOVED
= 1;
22 public static final int OBJECT_RENAMED
= 2;
23 public static final int OBJECT_CHANGED
= 3;
26 protected Object changeInfo
;
28 protected Binding oldBinding
;
29 protected Binding newBinding
;
31 public NamingEvent(EventContext source
, int type
, Binding newBd
,
32 Binding oldBd
, Object changeInfo
)
36 this.oldBinding
= oldBd
;
37 this.newBinding
= newBd
;
38 this.changeInfo
= changeInfo
;
39 // FIXME: for OBJECT_ADDED, newBd must not be null;
40 // FIXME: for OBJECT_CHANGED, newBd and oldBd must not be null;
41 // FIXME: for OBJECT_RENAMED, one of newBd or oldBd may be null if newBd or
42 // FIXME: oldBd is outside of the scope for which listener has registered.
43 // FIXME: namingExceptionThrown() is called for the listener in question.
51 public EventContext
getEventContext()
53 return (EventContext
) getSource();
56 public Binding
getOldBinding()
61 public Binding
getNewBinding()
66 public Object
getChangeInfo()
71 public void dispatch(NamingListener listener
)
76 ((NamespaceChangeListener
) listener
).objectAdded(this);
79 ((NamespaceChangeListener
) listener
).objectRemoved(this);
82 ((NamespaceChangeListener
) listener
).objectRenamed(this);
85 ((ObjectChangeListener
) listener
).objectChanged(this);