org.opennms.netmgt.config
Class DataCollectionConfigFactory

java.lang.Object
  extended by org.opennms.netmgt.config.DataCollectionConfigFactory
All Implemented Interfaces:
DataCollectionConfig

public final class DataCollectionConfigFactory
extends Object
implements DataCollectionConfig

This class is the main respository for SNMP data collection configuration information used by the SNMP service monitor. When this class is loaded it reads the snmp data collection configuration into memory. 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:
Weave , OpenNMS

Field Summary
 
Fields inherited from interface org.opennms.netmgt.config.DataCollectionConfig
ALL_IF_ATTRIBUTES, NODE_ATTRIBUTES
 
Constructor Summary
DataCollectionConfigFactory(Reader rdr)
           
 
Method Summary
 Map<String,ResourceType> getConfiguredResourceTypes()
           
static DataCollectionConfig getInstance()
          Return the singleton instance of this factory.
 List<MibObject> getMibObjectList(String cName, String aSysoid, String anAddress, int ifType)
          This method returns the list of MIB objects associated with a particular system object id, IP address, and ifType for the specified collection.
 List<String> getRRAList(String cName)
          Retrieves configured list of RoundRobin Archive statements.
 String getRrdPath()
           
 RrdRepository getRrdRepository(String collectionName)
           
 String getSnmpStorageFlag(String cName)
          Retrieves the configured value of the SNMP storage flag.
 int getStep(String cName)
          Retrieves configured RRD step size.
static void init()
          Load the config from the default config file and create the singleton instance of this factory.
 void processConfiguredResourceTypes()
           
static void reload()
          Reload the config from the default config file
static void setInstance(DataCollectionConfig instance)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataCollectionConfigFactory

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

getConfiguredResourceTypes

public Map<String,ResourceType> getConfiguredResourceTypes()
Specified by:
getConfiguredResourceTypes in interface DataCollectionConfig

processConfiguredResourceTypes

public void processConfiguredResourceTypes()

setInstance

public static void setInstance(DataCollectionConfig instance)

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.

getInstance

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

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

getMibObjectList

public List<MibObject> getMibObjectList(String cName,
                                        String aSysoid,
                                        String anAddress,
                                        int ifType)
This method returns the list of MIB objects associated with a particular system object id, IP address, and ifType for the specified collection.

Specified by:
getMibObjectList in interface DataCollectionConfig
Parameters:
cName - name of the data collection from which to retrieve oid information.
aSysoid - system object id to look up in the collection
anAddress - IP address to look up in the collection
ifType - Interface type (-1 indicates that only node-level objects should be retrieved.
Returns:
a list of MIB objects

getStep

public int getStep(String cName)
Retrieves configured RRD step size.

Specified by:
getStep in interface DataCollectionConfig
Parameters:
cName - Name of the data collection
Returns:
RRD step size for the specified collection

getRRAList

public List<String> getRRAList(String cName)
Retrieves configured list of RoundRobin Archive statements.

Specified by:
getRRAList in interface DataCollectionConfig
Parameters:
cName - Name of the data collection
Returns:
list of RRA strings.

getSnmpStorageFlag

public String getSnmpStorageFlag(String cName)
Retrieves the configured value of the SNMP storage flag.

Specified by:
getSnmpStorageFlag in interface DataCollectionConfig
Parameters:
cName - Name of the data collection
Returns:
SNMP storage flag

getRrdRepository

public RrdRepository getRrdRepository(String collectionName)
Specified by:
getRrdRepository in interface DataCollectionConfig

getRrdPath

public String getRrdPath()
Specified by:
getRrdPath in interface DataCollectionConfig


Copyright © 2009. All Rights Reserved.