KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > event > AuthenticationFailureEvent


1 /*_############################################################################
2   _##
3   _## SNMP4J - AuthenticationFailureEvent.java
4   _##
5   _## Copyright 2003-2007 Frank Fock and Jochen Katz (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21
22
23 package org.snmp4j.event;
24
25 import java.util.EventObject JavaDoc;
26 import org.snmp4j.smi.Address;
27 import org.snmp4j.TransportMapping;
28 import org.snmp4j.asn1.BERInputStream;
29 // For JavaDoc
30
import org.snmp4j.mp.SnmpConstants;
31
32 /**
33  * The <code>AuthenticationFailureEvent</code> class describes the source
34  * and type of an authentication failure as well as the message that caused
35  * the error.
36  *
37  * @author Frank Fock
38  * @version 1.5
39  * @since 1.5
40  */

41 public class AuthenticationFailureEvent extends EventObject JavaDoc {
42
43   private static final long serialVersionUID = -8623553792794471405L;
44
45   private Address address;
46   private transient TransportMapping transport;
47   private BERInputStream message;
48   private int error;
49
50   /**
51    * Creates an authentication failure event.
52    * @param source
53    * the instance that generated the event.
54    * @param sourceAddress
55    * the address from where the failed message has been received.
56    * @param transport
57    * the <code>TransportMapping</code> with which the message has been
58    * received.
59    * @param error
60    * the SNMP4J MP error status caused by the message
61    * (see {@link SnmpConstants}).
62    * @param message
63    * the message as received at the position where processing the message
64    * has stopped.
65    */

66   public AuthenticationFailureEvent(Object JavaDoc source,
67                                     Address sourceAddress,
68                                     TransportMapping transport,
69                                     int error,
70                                     BERInputStream message) {
71     super(source);
72     this.address = sourceAddress;
73     this.transport = transport;
74     this.error = error;
75     this.message = message;
76   }
77
78   /**
79    * Returns the transport mapping over which the message has bee received.
80    * @return
81    * a <code>TransportMapping</code> instance.
82    */

83   public TransportMapping getTransport() {
84     return transport;
85   }
86
87   /**
88    * Returns the message received.
89    * @return
90    * a <code>BERInputStream</code> at the position where processing of the
91    * message has stopped.
92    */

93   public BERInputStream getMessage() {
94     return message;
95   }
96
97   /**
98    * Returns the SNMP4J internal error status caused by the message.
99    * @return
100    * the error status.
101    */

102   public int getError() {
103     return error;
104   }
105
106   /**
107    * Returns the source address from which the message has been received.
108    * @return
109    * the source <code>Address</code>.
110    */

111   public Address getAddress() {
112     return address;
113   }
114
115 }
116
Popular Tags