public class AmiPeerFactory extends Object
AmiAgentConfig
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.Modifier and Type | Method and Description |
---|---|
AmiAgentConfig |
getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
|
static AmiConfig |
getAmiConfig()
getAmiConfig
|
static AmiPeerFactory |
getInstance()
Return the singleton instance of this factory.
|
Lock |
getReadLock() |
Lock |
getWriteLock() |
static void |
init()
Load the config from the default config file and create the singleton
instance of this factory.
|
static void |
reload()
Reload the config from the default config file
|
void |
saveCurrent()
Saves the current settings to disk
|
static void |
setAmiConfig(AmiConfig m_config)
setAmiConfig
|
static void |
setInstance(AmiPeerFactory singleton)
setInstance
|
public Lock getReadLock()
public Lock getWriteLock()
public static void init() throws IOException
IOException
- Thrown if the specified config file cannot be readIOException
- if any.public static void reload() throws IOException
IOException
- Thrown if the specified config file cannot be read/loadedIOException
- if any.public static AmiPeerFactory getInstance()
IllegalStateException
- Thrown if the factory has not yet been initialized.public static void setInstance(AmiPeerFactory singleton)
setInstance
singleton
- a AmiPeerFactory
object.public static void setAmiConfig(AmiConfig m_config)
setAmiConfig
m_config
- a AmiConfig
object.public void saveCurrent() throws Exception
Exception
- if saving settings to disk fails.public AmiAgentConfig getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
agentInetAddress
- a InetAddress
object.org.opennms.protocols.ami.AmiAgentConfig
object.Copyright © 2021. All rights reserved.