1 package net.sf.snmpadaptor4j; 2 3 import java.util.List; 4 5 /** 6 * JMX adaptor for SNMP protocol. 7 * @author <a href="http://fr.linkedin.com/in/jpminetti/">Jean-Philippe MINETTI</a> 8 */ 9 public interface SnmpAdaptorMBean { 10 11 /** 12 * Adds a new application context. 13 * <p> 14 * SnmpAdaptor4j may be used by an application server. In this case you will inform the SNMP adapter to each deployment of a new application. 15 * </p> 16 * @param classLoader Class loader of application. 17 * @param appContext Application context. 18 */ 19 void addAppContext (ClassLoader classLoader, SnmpAppContext appContext); 20 21 /** 22 * Removes an application context. 23 * @param classLoader Class loader of application. 24 */ 25 void removeAppContext (final ClassLoader classLoader); 26 27 /** 28 * Returns the listening IP address of SNMP daemon (127.0.0.1 by default). 29 * @return Listening IP address. 30 */ 31 String getListenerAddress (); 32 33 /** 34 * Sets the listening IP address of SNMP daemon. 35 * @param listenerAddress Listening IP address. 36 */ 37 void setListenerAddress (String listenerAddress); 38 39 /** 40 * Returns the UDP port of SNMP daemon (161 by default). 41 * @return UDP port. 42 */ 43 Integer getListenerPort (); 44 45 /** 46 * Sets the UDP port of SNMP daemon. 47 * @param listenerPort UDP port. 48 */ 49 void setListenerPort (Integer listenerPort); 50 51 /** 52 * Returns the protocol version of SNMP daemon (SNMP v2 by default). 53 * @return SNMP protocol version. 54 */ 55 Integer getListenerSnmpVersion (); 56 57 /** 58 * Sets the protocol version of SNMP daemon. 59 * @param listenerSnmpVersion SNMP protocol version. 60 */ 61 void setListenerSnmpVersion (Integer listenerSnmpVersion); 62 63 /** 64 * Returns the read community of SNMP daemon ("public" by default). 65 * @return Read community of SNMP daemon. 66 */ 67 String getListenerReadCommunity (); 68 69 /** 70 * Sets the read community of SNMP daemon. 71 * @param listenerReadCommunity Read community of SNMP daemon. 72 */ 73 void setListenerReadCommunity (String listenerReadCommunity); 74 75 /** 76 * Returns the write community of SNMP daemon ("private" by default). 77 * @return Write community of SNMP daemon. 78 */ 79 String getListenerWriteCommunity (); 80 81 /** 82 * Sets the write community of SNMP daemon. 83 * @param listenerWriteCommunity Write community of SNMP daemon. 84 */ 85 void setListenerWriteCommunity (String listenerWriteCommunity); 86 87 /** 88 * Returns the list of managers where to send all notifications (SNMP traps). 89 * @return List of managers. 90 */ 91 List<SnmpManagerConfiguration> getManagerList (); 92 93 /** 94 * Starts the SNMP daemon. 95 * @throws Exception Exception if an error has occurred. 96 */ 97 void start () throws Exception; 98 99 /** 100 * Stops the SNMP daemon. 101 * @throws Exception Exception if an error has occurred. 102 */ 103 void stop () throws Exception; 104 105 /** 106 * Returns <code>TRUE</code> if the SNMP daemon is started. 107 * @return <code>TRUE</code> if the SNMP daemon is started. 108 */ 109 boolean isStarted (); 110 111 }