01: /*_############################################################################
02: _##
03: _## SNMP4J-AgentX - AgentXCommandEvent.java
04: _##
05: _## Copyright (C) 2005-2007 Frank Fock (SNMP4J.org)
06: _##
07: _## This program is free software; you can redistribute it and/or modify
08: _## it under the terms of the GNU General Public License version 2 as
09: _## 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;
24:
25: import java.util.EventObject;
26:
27: import org.snmp4j.TransportMapping;
28: import org.snmp4j.smi.Address;
29:
30: public class AgentXCommandEvent extends EventObject {
31:
32: private Address peerAddress;
33: private TransportMapping peerTransport;
34: private AgentXPDU command;
35: private AgentXMessageDispatcher dispatcher;
36: private boolean processed;
37: private AgentXParseException exception;
38:
39: public AgentXCommandEvent(Object source,
40: AgentXMessageDispatcher dispatcher, Address peerAddress,
41: TransportMapping peerTransport, AgentXPDU command) {
42: super (source);
43: this .dispatcher = dispatcher;
44: this .peerTransport = peerTransport;
45: this .peerAddress = peerAddress;
46: this .command = command;
47: }
48:
49: public AgentXCommandEvent(Object source,
50: AgentXMessageDispatcher dispatcher, Address peerAddress,
51: TransportMapping peerTransport,
52: AgentXParseException exception) {
53: super (source);
54: this .dispatcher = dispatcher;
55: this .peerTransport = peerTransport;
56: this .peerAddress = peerAddress;
57: this .exception = exception;
58: }
59:
60: public AgentXPDU getCommand() {
61: return command;
62: }
63:
64: public Address getPeerAddress() {
65: return peerAddress;
66: }
67:
68: public TransportMapping getPeerTransport() {
69: return peerTransport;
70: }
71:
72: public AgentXMessageDispatcher getDispatcher() {
73: return dispatcher;
74: }
75:
76: public boolean isProcessed() {
77: return processed;
78: }
79:
80: public boolean isException() {
81: return (exception != null);
82: }
83:
84: public AgentXParseException getException() {
85: return exception;
86: }
87:
88: public void setProcessed(boolean done) {
89: this .processed = done;
90: }
91:
92: public String toString() {
93: return getClass().getName() + "[peerTransport=" + peerTransport
94: + ",peerAddress=" + peerAddress + ",processed="
95: + processed + ",command=" + command + "]";
96: }
97: }
|