KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > naming > event > NamingExceptionEvent


1 /*
2  * @(#)NamingExceptionEvent.java 1.7 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.naming.event;
9
10 import javax.naming.NamingException JavaDoc;
11
12 /**
13   * This class represents an event fired when the procedures/processes
14   * used to collect information for notifying listeners of
15   * <tt>NamingEvent</tt>s threw a <tt>NamingException</tt>.
16   * This can happen, for example, if the server which the listener is using
17   * aborts subsequent to the <tt>addNamingListener()</tt> call.
18   *
19   * @author Rosanna Lee
20   * @author Scott Seligman
21   * @version 1.7 03/12/19
22   *
23   * @see NamingListener#namingExceptionThrown
24   * @see EventContext
25   * @since 1.3
26   */

27
28 public class NamingExceptionEvent extends java.util.EventObject JavaDoc {
29     /**
30      * Contains the exception that was thrown
31      * @serial
32      */

33     private NamingException JavaDoc exception;
34
35     /**
36      * Constructs an instance of <tt>NamingExceptionEvent</tt> using
37      * the context in which the <tt>NamingException</tt> was thrown and the exception
38      * that was thrown.
39      *
40      * @param source The non-null context in which the exception was thrown.
41      * @param exc The non-null <tt>NamingException</tt> that was thrown.
42      *
43      */

44     public NamingExceptionEvent(EventContext JavaDoc source, NamingException JavaDoc exc) {
45     super(source);
46     exception = exc;
47     }
48
49     /**
50      * Retrieves the exception that was thrown.
51      * @return The exception that was thrown.
52      */

53     public NamingException JavaDoc getException() {
54     return exception;
55     }
56
57     /**
58      * Retrieves the <tt>EventContext</tt> that fired this event.
59      * This returns the same object as <tt>EventObject.getSource()</tt>.
60      * @return The non-null <tt>EventContext</tt> that fired this event.
61      */

62     public EventContext JavaDoc getEventContext() {
63     return (EventContext JavaDoc)getSource();
64     }
65
66     /**
67      * Invokes the <tt>namingExceptionThrown()</tt> method on
68      * a listener using this event.
69      * @param listener The non-null naming listener on which to invoke
70      * the method.
71      */

72     public void dispatch(NamingListener JavaDoc listener) {
73     listener.namingExceptionThrown(this);
74     }
75
76     private static final long serialVersionUID = -4877678086134736336L;
77 }
78
Popular Tags