1 7 8 package javax.naming.event; 9 10 import javax.naming.Binding ; 11 12 56 public class NamingEvent extends java.util.EventObject { 57 61 public static final int OBJECT_ADDED = 0; 62 63 67 public static final int OBJECT_REMOVED = 1; 68 69 90 public static final int OBJECT_RENAMED = 2; 91 92 102 public static final int OBJECT_CHANGED = 3; 103 104 108 protected Object changeInfo; 109 110 118 protected int type; 119 120 124 protected Binding oldBinding; 125 126 130 protected Binding newBinding; 131 132 155 public NamingEvent(EventContext source, int type, 156 Binding newBd, Binding oldBd, Object changeInfo) { 157 super(source); 158 this.type = type; 159 oldBinding = oldBd; 160 newBinding = newBd; 161 this.changeInfo = changeInfo; 162 } 163 164 172 public int getType() { 173 return type; 174 } 175 176 191 public EventContext getEventContext() { 192 return (EventContext )getSource(); 193 } 194 195 213 public Binding getOldBinding() { 214 return oldBinding; 215 } 216 217 235 public Binding getNewBinding() { 236 return newBinding; 237 } 238 239 246 public Object getChangeInfo() { 247 return changeInfo; 248 } 249 250 263 public void dispatch(NamingListener listener) { 264 switch (type) { 265 case OBJECT_ADDED: 266 ((NamespaceChangeListener )listener).objectAdded(this); 267 break; 268 269 case OBJECT_REMOVED: 270 ((NamespaceChangeListener )listener).objectRemoved(this); 271 break; 272 273 case OBJECT_RENAMED: 274 ((NamespaceChangeListener )listener).objectRenamed(this); 275 break; 276 277 case OBJECT_CHANGED: 278 ((ObjectChangeListener )listener).objectChanged(this); 279 break; 280 } 281 } 282 private static final long serialVersionUID = -7126752885365133499L; 283 } 284
| Popular Tags
|