KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > agentx > event > PingEvent


1 /*_############################################################################
2   _##
3   _## SNMP4J-AgentX - PingEvent.java
4   _##
5   _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
6   _##
7   _## This program is free software; you can redistribute it and/or modify
8   _## it under the terms of the GNU General Public License version 2 as
9   _## published by the Free Software Foundation.
10   _##
11   _## This program is distributed in the hope that it will be useful,
12   _## but WITHOUT ANY WARRANTY; without even the implied warranty of
13   _## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   _## GNU General Public License for more details.
15   _##
16   _## You should have received a copy of the GNU General Public License
17   _## along with this program; if not, write to the Free Software
18   _## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19   _## MA 02110-1301 USA
20   _##
21   _##########################################################################*/

22
23 package org.snmp4j.agent.agentx.event;
24
25 import java.util.EventObject JavaDoc;
26
27 import org.snmp4j.agent.agentx.AgentXResponsePDU;
28 import org.snmp4j.agent.agentx.AgentXSession;
29
30 /**
31  * The <code>PingEvent</code> object describes an AgentX ping result.
32  * @author Frank Fock
33  * @version 1.0
34  */

35 public class PingEvent extends EventObject JavaDoc {
36
37   private AgentXSession session;
38   private AgentXResponsePDU response;
39   private boolean closeSession;
40   private boolean resetSession;
41   private Exception JavaDoc error;
42
43   public PingEvent(Object JavaDoc source,
44                    AgentXSession pingedSession,
45                    AgentXResponsePDU pingResponse){
46     super(source);
47     this.session = pingedSession;
48     this.response = pingResponse;
49   }
50
51   public PingEvent(Object JavaDoc source,
52                    AgentXSession pingedSession,
53                    Exception JavaDoc error){
54     super(source);
55     this.session = pingedSession;
56     this.error = error;
57   }
58
59   public AgentXResponsePDU getResponse() {
60     return response;
61   }
62
63   public AgentXSession getSession() {
64     return session;
65   }
66
67   public boolean isCloseSession() {
68     return closeSession;
69   }
70
71   public boolean isResetSession() {
72     return resetSession;
73   }
74
75   public Exception JavaDoc getError() {
76     return error;
77   }
78
79   public void setCloseSession(boolean closeSession) {
80     this.closeSession = closeSession;
81   }
82
83   public void setResetSession(boolean resetSession) {
84     this.resetSession = resetSession;
85   }
86
87   public String JavaDoc toString() {
88     return getClass().getName()+"[session="+session+",response="+response+
89         ",error="+error+
90         ",closeSession="+closeSession+",resetSession="+resetSession+"]";
91   }
92 }
93
Popular Tags