KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > jmx > adaptor > snmp > agent > TrapFactory


1 /*
2  * Copyright (c) 2003, Intracom S.A. - www.intracom.com
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version
8  *
9  * 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 JavaDoc;
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: 44604 $
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    /**
68     * Sets the name of the file containing the notification/trap mappings,
69     * the uptime clock and the trap counter
70    **/

71    public void set(String JavaDoc notificationMapResName, Clock uptime, 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()
78       throws Exception JavaDoc;
79    
80    /**
81     * Translates a Notification to an SNMP V2 trap.
82     *
83     * @param the notification to be translated
84    **/

85    public SnmpPduPacket generateV2Trap(Notification JavaDoc n)
86       throws MappingFailedException;
87
88    /**
89     * Traslates a Notification to an SNMP V1 trap.
90     *
91     * @param the notification to be translated
92    **/

93    public SnmpPduTrap generateV1Trap(Notification JavaDoc n)
94       throws MappingFailedException;
95           
96 } // TrapFactory
97
Popular Tags