org.opennms.netmgt.config
Class VulnscandConfigFactory

java.lang.Object
  extended by org.opennms.netmgt.config.VulnscandConfigFactory

public final class VulnscandConfigFactory
extends Object

This is the singleton class used to load the configuration for the OpenNMS Vulnscand service from the vulnscand-configuration xml file. 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:
Seth Leger , Mike Davidson , Weave , OpenNMS

Method Summary
 void addRange(int level, InetAddress begin, InetAddress end)
           
 void addRange(ScanLevel level, InetAddress begin, InetAddress end)
           
 void addSpecific(int level, InetAddress specific)
           
 void addSpecific(ScanLevel level, InetAddress specific)
           
 Set getAllExcludes()
           
 Set getAllIpAddresses(int level)
           
 Set getAllIpAddresses(ScanLevel level)
           
static VulnscandConfiguration getConfiguration()
          Return the Vulnscand configuration object.
 long getInitialSleepTime()
           
static VulnscandConfigFactory getInstance()
          Return the singleton instance of this factory.
static int getInterfaceDbNodeId(Connection dbConn, InetAddress ifAddress)
           
 int getManagedInterfacesScanLevel()
           
 boolean getManagedInterfacesStatus()
           
 int getMaxRescanThreadPoolSize()
           
 int getMaxSuspectThreadPoolSize()
           
 String[] getPluginLists()
          Gets the cached value of the plugin lists in the config file
 long getRescanFrequency()
           
 boolean[] getSafeChecks()
          Gets the cached value of the safe checks settings in the config file
 InetAddress getServerAddress()
           
 String getServerPassword()
           
 int getServerPort()
           
 String getServerUsername()
           
 boolean getStatus()
           
static void init()
          Load the config from the default config file and create the singleton instance of this factory.
static boolean isInterfaceInDB(Connection dbConn, InetAddress ifAddress)
           
static void reload()
          Reload the config from the default config file
 void removeExcludeRange(InetAddress begin, InetAddress end)
           
 void removeExcludeSpecific(InetAddress specific)
           
 void removeRange(int level, InetAddress begin, InetAddress end)
           
 void removeRange(ScanLevel level, InetAddress begin, InetAddress end)
           
 void removeSpecific(int level, InetAddress specific)
           
 void removeSpecific(ScanLevel level, InetAddress specific)
           
static void saveCurrent()
          Saves the current settings to disk
static InetAddress toInetAddress(long address)
           Converts a 64-bit unsigned quantity to a IPv4 dotted decimal string address.
static long toLong(InetAddress addr)
          Deprecated. See org.opennms.core.utils.InetAddressCollection.toLong(InetAddress addr)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

getInstance

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

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

getConfiguration

public static VulnscandConfiguration getConfiguration()
Return the Vulnscand configuration object.


toLong

public static long toLong(InetAddress addr)
Deprecated. See org.opennms.core.utils.InetAddressCollection.toLong(InetAddress addr)

This method is used to convert the passed IP address to a long value. The address is converted in network byte order (big endin). This is compatable with the number format of the JVM, and thus the return longs can be compared with other converted IP Addresses to determine inclusion.

Parameters:
addr - The IP address to convert.
Returns:
The converted IP address.

toInetAddress

public static InetAddress toInetAddress(long address)
                                 throws UnknownHostException

Converts a 64-bit unsigned quantity to a IPv4 dotted decimal string address.

Parameters:
address - The 64-bit quantity to convert.
Returns:
The dotted decimal IPv4 address string.
Throws:
UnknownHostException

isInterfaceInDB

public static boolean isInterfaceInDB(Connection dbConn,
                                      InetAddress ifAddress)
                               throws SQLException
Throws:
SQLException

getInterfaceDbNodeId

public static int getInterfaceDbNodeId(Connection dbConn,
                                       InetAddress ifAddress)
                                throws SQLException
Throws:
SQLException

addSpecific

public void addSpecific(int level,
                        InetAddress specific)

addSpecific

public void addSpecific(ScanLevel level,
                        InetAddress specific)

addRange

public void addRange(int level,
                     InetAddress begin,
                     InetAddress end)

addRange

public void addRange(ScanLevel level,
                     InetAddress begin,
                     InetAddress end)

removeSpecific

public void removeSpecific(int level,
                           InetAddress specific)

removeSpecific

public void removeSpecific(ScanLevel level,
                           InetAddress specific)

removeRange

public void removeRange(int level,
                        InetAddress begin,
                        InetAddress end)

removeRange

public void removeRange(ScanLevel level,
                        InetAddress begin,
                        InetAddress end)

getAllIpAddresses

public Set getAllIpAddresses(int level)

getAllIpAddresses

public Set getAllIpAddresses(ScanLevel level)

getAllExcludes

public Set getAllExcludes()

removeExcludeRange

public void removeExcludeRange(InetAddress begin,
                               InetAddress end)

removeExcludeSpecific

public void removeExcludeSpecific(InetAddress specific)

getRescanFrequency

public long getRescanFrequency()

getInitialSleepTime

public long getInitialSleepTime()

getServerAddress

public InetAddress getServerAddress()

getPluginLists

public String[] getPluginLists()
Gets the cached value of the plugin lists in the config file


getSafeChecks

public boolean[] getSafeChecks()
Gets the cached value of the safe checks settings in the config file


getServerPort

public int getServerPort()

getServerUsername

public String getServerUsername()

getServerPassword

public String getServerPassword()

getStatus

public boolean getStatus()

getManagedInterfacesStatus

public boolean getManagedInterfacesStatus()

getManagedInterfacesScanLevel

public int getManagedInterfacesScanLevel()

getMaxSuspectThreadPoolSize

public int getMaxSuspectThreadPoolSize()

getMaxRescanThreadPoolSize

public int getMaxRescanThreadPoolSize()


Copyright © 2009. All Rights Reserved.