Package org.opennms.netmgt.config
Class WmiDataCollectionConfigFactory
- java.lang.Object
-
- org.opennms.netmgt.config.WmiDataCollectionConfigFactory
-
public class WmiDataCollectionConfigFactory extends java.lang.Object
This class loads and presents the WMI data collection configuration file for use with the WMI performance collection classes.
- Author:
- Matt Raykowski, OpenNMS
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
initialized
Boolean indicating if the init() method has been called.protected static long
m_lastModified
Timestamp of the WMI collection config, used to know when to reload from disk.
-
Constructor Summary
Constructors Constructor Description WmiDataCollectionConfigFactory(java.io.InputStream is)
Constructor for WmiDataCollectionConfigFactory.WmiDataCollectionConfigFactory(java.lang.String configFile)
Constructor for WmiDataCollectionConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WmiDatacollectionConfig
getConfig()
getConfigstatic WmiDataCollectionConfigFactory
getInstance()
Singleton static call to get the only instance that should existjava.util.List<java.lang.String>
getRRAList(java.lang.String cName)
getRRAListjava.lang.String
getRrdPath()
getRrdPathRrdRepository
getRrdRepository(java.lang.String collectionName)
getRrdRepositoryint
getStep(java.lang.String cName)
getStepWmiCollection
getWmiCollection(java.lang.String collectionName)
getWmiCollectionstatic void
init()
Be sure to call this method before calling getInstance().void
reload()
reloadstatic void
setConfig(WmiDatacollectionConfig m_config)
setConfigstatic void
setInstance(WmiDataCollectionConfigFactory instance)
setInstanceprotected void
updateFromFile()
Reload the wmi-datacollection-config.xml file if it has been changed since we last read it.
-
-
-
Constructor Detail
-
WmiDataCollectionConfigFactory
public WmiDataCollectionConfigFactory(java.lang.String configFile) throws java.io.IOException
Constructor for WmiDataCollectionConfigFactory.
- Parameters:
configFile
- aString
object.- Throws:
java.io.IOException
- if any.
-
WmiDataCollectionConfigFactory
public WmiDataCollectionConfigFactory(java.io.InputStream is) throws java.io.IOException
Constructor for WmiDataCollectionConfigFactory.
- Parameters:
is
- aInputStream
object.- Throws:
java.io.IOException
-
-
Method Detail
-
init
public static void init() throws java.io.IOException, java.io.FileNotFoundException
Be sure to call this method before calling getInstance().- Throws:
java.io.IOException
- if any.java.io.FileNotFoundException
- if any.
-
getInstance
public static WmiDataCollectionConfigFactory getInstance()
Singleton static call to get the only instance that should exist- Returns:
- the single factory instance
- Throws:
java.lang.IllegalStateException
- if init has not been called
-
setInstance
public static void setInstance(WmiDataCollectionConfigFactory instance)
setInstance
- Parameters:
instance
- aWmiDataCollectionConfigFactory
object.
-
reload
public void reload() throws java.io.IOException, java.io.FileNotFoundException
reload
- Throws:
java.io.IOException
- if any.java.io.FileNotFoundException
- if any.
-
updateFromFile
protected void updateFromFile() throws java.io.IOException
Reload the wmi-datacollection-config.xml file if it has been changed since we last read it.- Throws:
java.io.IOException
- if any.
-
getConfig
public static WmiDatacollectionConfig getConfig()
getConfig
- Returns:
- a
WmiDatacollectionConfig
object.
-
setConfig
public static void setConfig(WmiDatacollectionConfig m_config)
setConfig
- Parameters:
m_config
- aWmiDatacollectionConfig
object.
-
getWmiCollection
public WmiCollection getWmiCollection(java.lang.String collectionName)
getWmiCollection
- Parameters:
collectionName
- aString
object.- Returns:
- a
WmiCollection
object.
-
getRrdRepository
public RrdRepository getRrdRepository(java.lang.String collectionName)
getRrdRepository
- Parameters:
collectionName
- aString
object.- Returns:
- a
RrdRepository
object.
-
getStep
public int getStep(java.lang.String cName)
getStep
- Parameters:
cName
- aString
object.- Returns:
- a int.
-
getRRAList
public java.util.List<java.lang.String> getRRAList(java.lang.String cName)
getRRAList
- Parameters:
cName
- aString
object.- Returns:
- a
List
object.
-
getRrdPath
public java.lang.String getRrdPath()
getRrdPath
- Returns:
- a
String
object.
-
-