01: /*
02: * Copyright (c) 2003, Intracom S.A. - www.intracom.com
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: * This package and its source code is available at www.jboss.org
19: **/
20: package org.jboss.jmx.adaptor.snmp.agent;
21:
22: import javax.management.Notification;
23:
24: import org.opennms.protocols.snmp.SnmpPduPacket;
25: import org.opennms.protocols.snmp.SnmpPduTrap;
26:
27: /**
28: * <tt>TrapFactory </tt> takes care of translation of Notifications into
29: * SNMP V1 and V2 traps
30: *
31: * Trap-PDU ::=
32: * [4]
33: * IMPLICIT SEQUENCE {
34: * enterprise -- type of object generating
35: * -- trap, see sysObjectID in [5]
36: * OBJECT IDENTIFIER,
37: * agent-addr -- address of object generating
38: * NetworkAddress, -- trap
39: * generic-trap -- generic trap type
40: * INTEGER {
41: * coldStart(0),
42: * warmStart(1),
43: * linkDown(2),
44: * linkUp(3),
45: * authenticationFailure(4),
46: * egpNeighborLoss(5),
47: * enterpriseSpecific(6)
48: * },
49: * specific-trap -- specific code, present even
50: * INTEGER, -- if generic-trap is not
51: * -- enterpriseSpecific
52: * time-stamp -- time elapsed between the last
53: * TimeTicks, -- (re)initialization of the network
54: * -- entity and the generation of the
55: * trap
56: * variable-bindings -- "interesting" information
57: * VarBindList
58: * }
59: *
60: * @version $Revision: 23902 $
61: *
62: * @author <a href="mailto:spol@intracom.gr">Spyros Pollatos</a>
63: * @author <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
64: **/
65: public interface TrapFactory {
66: /**
67: * Sets the name of the file containing the notification/trap mappings,
68: * the uptime clock and the trap counter
69: **/
70: public void set(String notificationMapResName, Clock uptime,
71: Counter count);
72:
73: /**
74: * Performs all the required initialisation in order for the mapper to
75: * commence operation (e.g. reading of the resource file)
76: **/
77: public void start() throws Exception;
78:
79: /**
80: * Translates a Notification to an SNMP V2 trap.
81: *
82: * @param the notification to be translated
83: **/
84: public SnmpPduPacket generateV2Trap(Notification n)
85: throws MappingFailedException;
86:
87: /**
88: * Traslates a Notification to an SNMP V1 trap.
89: *
90: * @param the notification to be translated
91: **/
92: public SnmpPduTrap generateV1Trap(Notification n)
93: throws MappingFailedException;
94:
95: } // TrapFactory
|