01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package javax.naming.event;
19:
20: import java.util.EventObject;
21:
22: import javax.naming.NamingException;
23:
24: /**
25: * An event object contains a <code>NamingException</code>.
26: */
27: public class NamingExceptionEvent extends EventObject {
28:
29: private static final long serialVersionUID = 0xbc4f019fab3b5a30L;
30:
31: /**
32: * Associated exception of this event
33: *
34: * @serial
35: */
36: private NamingException exception;
37:
38: /**
39: * Constructs a <code>NamingExceptionEvent</code> instance with a
40: * <code>EventContext</code> and a <code>NamingException</code>.
41: *
42: * @param eventContext
43: * context that generated this event. It is the originator of
44: * this event and cannot be null.
45: * @param namingException
46: * the associated exception and cannot be null.
47: */
48: public NamingExceptionEvent(EventContext eventContext,
49: NamingException namingException) {
50: super (eventContext);
51: this .exception = namingException;
52: }
53:
54: /**
55: * Calls a method to notify the listener that a naming exception has been
56: * thrown.
57: *
58: * @param naminglistener
59: * the listener to be notified
60: */
61: public void dispatch(NamingListener naminglistener) {
62: naminglistener.namingExceptionThrown(this );
63: }
64:
65: /**
66: * Gets the source of the event.
67: *
68: * @return the source of the event
69: */
70: public EventContext getEventContext() {
71: return (EventContext) getSource();
72: }
73:
74: /**
75: * Gets the associated <code>NamingException</code>.
76: *
77: * @return the associated <code>NamingException</code>
78: */
79: public NamingException getException() {
80: return exception;
81: }
82:
83: }
|