|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.config.PeerFactory
org.opennms.netmgt.config.SnmpPeerFactory
public final class SnmpPeerFactory
This class is the main respository for SNMP configuration information used by
the capabilities daemon. When this class is loaded it reads the snmp
configuration into memory, and uses the configuration to find the
SnmpAgentConfig objects for specific
addresses. If an address cannot be located in the configuration then a
default peer instance is returned to the caller.
Note: Users of this class should make sure the
init() is called before calling any other method to ensure the
config is loaded before accessing other convenience methods.
| Constructor Summary | |
|---|---|
SnmpPeerFactory(java.io.Reader rdr)
|
|
| Method Summary | |
|---|---|
void |
define(java.net.InetAddress ip,
java.lang.String community)
Puts a specific IP address with associated read-community string into the currently loaded snmp-config.xml. |
void |
define(SnmpEventInfo info)
Enhancement: Allows specific or ranges to be merged into snmp configuration with many other attributes. |
org.opennms.netmgt.snmp.SnmpAgentConfig |
getAgentConfig(java.net.InetAddress agentAddress)
|
org.opennms.netmgt.snmp.SnmpAgentConfig |
getAgentConfig(java.net.InetAddress agentInetAddress,
int requestedSnmpVersion)
|
static SnmpPeerFactory |
getInstance()
Return the singleton instance of this factory. |
static org.opennms.netmgt.config.snmp.SnmpConfig |
getSnmpConfig()
|
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
static java.lang.String |
marshallConfig()
Creates a string containing the XML of the current SnmpConfig |
static void |
reload()
Reload the config from the default config file |
static void |
saveCurrent()
Saves the current settings to disk |
static void |
setInstance(SnmpPeerFactory singleton)
|
static void |
setSnmpConfig(org.opennms.netmgt.config.snmp.SnmpConfig m_config)
|
static java.lang.String |
toIpAddr(long ip)
display an IP as a dotted quad xxx.xxx.xxx.xxx |
| Methods inherited from class org.opennms.netmgt.config.PeerFactory |
|---|
countChar, matchNumericListOrRange, matchRange, toLong, verifyIpMatch |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SnmpPeerFactory(java.io.Reader rdr)
throws java.io.IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
java.io.IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException| Method Detail |
|---|
public static void init()
throws java.io.IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
java.io.IOException - Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.
public static void reload()
throws java.io.IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
java.io.IOException - Thrown if the specified config file cannot be read/loaded
org.exolab.castor.xml.MarshalException - Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException - Thrown if the contents do not match the required schema.
public static void saveCurrent()
throws java.lang.Exception
java.lang.Exceptionpublic static SnmpPeerFactory getInstance()
java.lang.IllegalStateException - Thrown if the factory has not yet been initialized.public static void setInstance(SnmpPeerFactory singleton)
public void define(java.net.InetAddress ip,
java.lang.String community)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic org.opennms.netmgt.snmp.SnmpAgentConfig getAgentConfig(java.net.InetAddress agentAddress)
public org.opennms.netmgt.snmp.SnmpAgentConfig getAgentConfig(java.net.InetAddress agentInetAddress,
int requestedSnmpVersion)
public static org.opennms.netmgt.config.snmp.SnmpConfig getSnmpConfig()
public static void setSnmpConfig(org.opennms.netmgt.config.snmp.SnmpConfig m_config)
public static java.lang.String toIpAddr(long ip)
public void define(SnmpEventInfo info)
throws java.net.UnknownHostException
java.net.UnknownHostExceptionpublic static java.lang.String marshallConfig()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||