public class WmiPeerFactory extends AbstractWritableJaxbConfigDao<WmiConfig,WmiConfig>
WmiAgentConfig
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.AbstractJaxbConfigDao.JaxbReloadCallback
Constructor and Description |
---|
WmiPeerFactory() |
WmiPeerFactory(org.springframework.core.io.Resource resource) |
Modifier and Type | Method and Description |
---|---|
WmiAgentConfig |
getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
|
WmiConfig |
getConfig() |
static WmiPeerFactory |
getInstance()
Return the singleton instance of this factory.
|
static void |
init()
Load the config from the default config file and create the singleton
instance of this factory.
|
void |
optimize()
Combine specific and range elements so that WMIPeerFactory has to spend
less time iterating all these elements.
|
static void |
reload()
Reload the config from the default config file
|
static void |
setInstance(WmiPeerFactory instance)
setInstance
|
WmiConfig |
translateConfig(WmiConfig config)
translateConfig
|
getObject, getReadLock, getWriteLock, saveCurrent, update
addOnReloadedCallback, afterPropertiesSet, getConfigResource, getContainer, getDescription, getReloadCheckInterval, loadConfig, setConfigResource, setReloadCheckInterval
public WmiPeerFactory()
public WmiPeerFactory(org.springframework.core.io.Resource resource)
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 WmiPeerFactory getInstance()
IllegalStateException
- Thrown if the factory has not yet been initialized.public static void setInstance(WmiPeerFactory instance)
setInstance
public WmiConfig translateConfig(WmiConfig config)
AbstractJaxbConfigDao
translateConfig
translateConfig
in class AbstractJaxbConfigDao<WmiConfig,WmiConfig>
config
- a K object.public WmiConfig getConfig()
public void optimize() throws UnknownHostException
UnknownHostException
public WmiAgentConfig getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
agentInetAddress
- a InetAddress
object.org.opennms.protocols.wmi.WmiAgentConfig
object.Copyright © 2021. All rights reserved.