public class SnmpPeerFactory extends Object implements SnmpAgentConfigFactory
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 and Description | 
|---|
SnmpPeerFactory(org.springframework.core.io.Resource resource)
Constructor for SnmpPeerFactory. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
define(SnmpEventInfo info)
Enhancement: Allows specific or ranges to be merged into SNMP configuration
 with many other attributes. 
 | 
SnmpAgentConfig | 
getAgentConfig(InetAddress agentAddress)
getAgentConfig 
 | 
static File | 
getFile()  | 
static SnmpPeerFactory | 
getInstance()
Load the config from the default config file and create the singleton instance of this factory. 
 | 
protected static Lock | 
getReadLock()  | 
SnmpConfig | 
getSnmpConfig()
getSnmpConfig 
 | 
String | 
getSnmpConfigAsString()
Creates a string containing the XML of the current SnmpConfig 
 | 
int | 
getVersionCode(Definition def,
              SnmpConfig config,
              int requestedSnmpVersion)  | 
protected static Lock | 
getWriteLock()  | 
static void | 
init()  | 
void | 
saveCurrent()
Saves the current settings to disk 
 | 
void | 
saveToFile(File file)  | 
static void | 
setFile(File configFile)
setFile 
 | 
static void | 
setInstance(SnmpPeerFactory singleton)
setInstance 
 | 
public SnmpPeerFactory(org.springframework.core.io.Resource resource)
Constructor for SnmpPeerFactory.
resource - a Resource object.protected static Lock getReadLock()
protected static Lock getWriteLock()
public static void init()
                 throws IOException
IOExceptionpublic static SnmpPeerFactory getInstance()
IOException - Thrown if the specified config file cannot be readpublic static void setInstance(SnmpPeerFactory singleton)
setInstance
singleton - a SnmpPeerFactory object.public static File getFile() throws IOException
IOExceptionpublic void saveCurrent()
                 throws IOException
IOException - if any.org.exolab.castor.xml.MarshalException - if any.org.exolab.castor.xml.ValidationException - if any.public void saveToFile(File file) throws UnsupportedEncodingException, FileNotFoundException, IOException
public SnmpAgentConfig getAgentConfig(InetAddress agentAddress)
getAgentConfig
getAgentConfig in interface SnmpAgentConfigFactoryagentAddress - a InetAddress object.SnmpAgentConfig object.public int getVersionCode(Definition def, SnmpConfig config, int requestedSnmpVersion)
public SnmpConfig getSnmpConfig()
getSnmpConfig
SnmpConfig object.public void define(SnmpEventInfo info)
info - a SnmpEventInfo object.public String getSnmpConfigAsString()
Copyright © 2015. All rights reserved.