public class WmiPeerFactory extends Object
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.Constructor and Description |
---|
WmiPeerFactory(InputStream stream)
Constructor for WmiPeerFactory.
|
Modifier and Type | Method and Description |
---|---|
WmiAgentConfig |
getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
|
static WmiPeerFactory |
getInstance()
Return the singleton instance of this factory.
|
static WmiConfig |
getWmiConfig()
getWmiConfig
|
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
|
static void |
saveCurrent()
Saves the current settings to disk
|
static void |
setInstance(WmiPeerFactory singleton)
setInstance
|
static void |
setWmiConfig(WmiConfig m_config)
setWmiConfig
|
public WmiPeerFactory(InputStream stream) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
Constructor for WmiPeerFactory.
stream
- a InputStream
object.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public static void init() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
- Thrown if the specified config file cannot be readorg.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.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public static void reload() throws IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
IOException
- Thrown if the specified config file cannot be read/loadedorg.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.IOException
- if any.org.exolab.castor.xml.MarshalException
- if any.org.exolab.castor.xml.ValidationException
- if any.public static void saveCurrent() throws Exception
Exception
- if saving settings to disk fails.public static WmiPeerFactory getInstance()
IllegalStateException
- Thrown if the factory has not yet been initialized.public static void setInstance(WmiPeerFactory singleton)
setInstance
singleton
- a WmiPeerFactory
object.public WmiAgentConfig getAgentConfig(InetAddress agentInetAddress)
getAgentConfig
agentInetAddress
- a InetAddress
object.org.opennms.protocols.wmi.WmiAgentConfig
object.Copyright © 2017. All rights reserved.