org.opennms.netmgt.config
Class WmiPeerFactory

java.lang.Object
  extended by org.opennms.netmgt.config.PeerFactory
      extended by org.opennms.netmgt.config.WmiPeerFactory

public class WmiPeerFactory
extends PeerFactory

This class is the main respository for WMI configuration information used by the capabilities daemon. When this class is loaded it reads the WMI configuration into memory, and uses the configuration to find the 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.

Author:
David Hustace , Weave , Gerald Turner , Matt Raykowski, OpenNMS

Constructor Summary
WmiPeerFactory(Reader rdr)
           
 
Method Summary
 void define(InetAddress ip, String username, String password, String domain)
          Puts a specific IP address with associated password into the currently loaded wmi-config.xml.
 WmiAgentConfig getAgentConfig(InetAddress agentInetAddress)
           
static WmiPeerFactory getInstance()
          Return the singleton instance of this factory.
static WmiConfig 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)
           
static void setWmiConfig(WmiConfig m_config)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WmiPeerFactory

public WmiPeerFactory(Reader rdr)
               throws IOException,
                      org.exolab.castor.xml.MarshalException,
                      org.exolab.castor.xml.ValidationException
Throws:
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException
Method Detail

init

public static void init()
                 throws IOException,
                        org.exolab.castor.xml.MarshalException,
                        org.exolab.castor.xml.ValidationException
Load the config from the default config file and create the singleton instance of this factory.

Throws:
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.

reload

public static void reload()
                   throws IOException,
                          org.exolab.castor.xml.MarshalException,
                          org.exolab.castor.xml.ValidationException
Reload the config from the default config file

Throws:
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.

saveCurrent

public static void saveCurrent()
                        throws Exception
Saves the current settings to disk

Throws:
Exception - if saving settings to disk fails.

getInstance

public static WmiPeerFactory getInstance()
Return the singleton instance of this factory.

Returns:
The current factory instance.
Throws:
IllegalStateException - Thrown if the factory has not yet been initialized.

setInstance

public static void setInstance(WmiPeerFactory singleton)

define

public void define(InetAddress ip,
                   String username,
                   String password,
                   String domain)
            throws UnknownHostException
Puts a specific IP address with associated password into the currently loaded wmi-config.xml. Perhaps with a bit of jiggery pokery this could be pulled up into PeerFactory

Parameters:
ip - the ip address of a definition
password - the password for a definition
Throws:
UnknownHostException

getAgentConfig

public WmiAgentConfig getAgentConfig(InetAddress agentInetAddress)

getWmiConfig

public static WmiConfig getWmiConfig()

setWmiConfig

public static void setWmiConfig(WmiConfig m_config)


Copyright © 2009. All Rights Reserved.