1 package net.sf.snmpadaptor4j.api;
2
3 import net.sf.snmpadaptor4j.object.SnmpTrap;
4
5 /**
6 * Object responsible for sending of SNMP traps to one manager.
7 * <p>
8 * Classes implementing this interface encapsulate the SNMP API. To change the API, just create a new implementation of {@link SnmpTrapSender}.
9 * </p>
10 * @author <a href="http://fr.linkedin.com/in/jpminetti/">Jean-Philippe MINETTI</a>
11 */
12 public interface SnmpTrapSender {
13
14 /**
15 * Returns the name given to SNMP manager.
16 * @return Name given to SNMP manager.
17 */
18 String getName ();
19
20 /**
21 * Opens the connection to the SNMP manager.
22 * @throws Exception Exception if an error has occurred.
23 */
24 void open () throws Exception;
25
26 /**
27 * Closes the connection with the SNMP manager.
28 */
29 void close ();
30
31 /**
32 * Returns <code>TRUE</code> if the connection is established to the SNMP manager.
33 * @return <code>TRUE</code> if the connection is established.
34 */
35 boolean isConnected ();
36
37 /**
38 * Sends a SNMP trap to the manager.
39 * @param trap Object representing a specific or generic SNMP trap.
40 * @throws Exception Exception if an error has occurred.
41 */
42 void send (SnmpTrap trap) throws Exception;
43
44 }