Class NSClientDataCollectionConfigFactory
- java.lang.Object
-
- org.opennms.protocols.nsclient.config.NSClientDataCollectionConfigFactory
-
public class NSClientDataCollectionConfigFactory extends Object
NSClientDataCollectionConfigFactory class.
- Author:
- Craig Miskell
-
-
Field Summary
Fields Modifier and Type Field Description protected static longm_lastModifiedTimestamp of the nsclient collection config, used to know when to reload from disk.
-
Constructor Summary
Constructors Constructor Description NSClientDataCollectionConfigFactory(String configFile)Constructor for NSClientDataCollectionConfigFactory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NSClientDataCollectionConfigFactorygetInstance()Singleton static call to get the only instance that should existNsclientCollectiongetNSClientCollection(String collectionName)getNSClientCollectionLockgetReadLock()List<String>getRRAList(String cName)getRRAListStringgetRrdPath()getRrdPathRrdRepositorygetRrdRepository(String collectionName)getRrdRepositoryintgetStep(String cName)getStepLockgetWriteLock()static voidinit()Be sure to call this method before calling getInstance().voidreload()reloadstatic voidsetInstance(NSClientDataCollectionConfigFactory instance)setInstanceprotected voidupdateFromFile()Reload the nsclient-datacollection-config.xml file if it has been changed since we last read it.
-
-
-
Constructor Detail
-
NSClientDataCollectionConfigFactory
public NSClientDataCollectionConfigFactory(String configFile) throws IOException
Constructor for NSClientDataCollectionConfigFactory.
- Parameters:
configFile- aStringobject.- Throws:
IOException- if any.
-
-
Method Detail
-
getReadLock
public Lock getReadLock()
-
getWriteLock
public Lock getWriteLock()
-
init
public static void init() throws IOException, FileNotFoundExceptionBe sure to call this method before calling getInstance().- Throws:
IOException- if any.FileNotFoundException- if any.
-
getInstance
public static NSClientDataCollectionConfigFactory getInstance()
Singleton static call to get the only instance that should exist- Returns:
- the single factory instance
- Throws:
IllegalStateException- if init has not been called
-
setInstance
public static void setInstance(NSClientDataCollectionConfigFactory instance)
setInstance
- Parameters:
instance- aNSClientDataCollectionConfigFactoryobject.
-
reload
public void reload() throws IOException, FileNotFoundExceptionreload
- Throws:
IOException- if any.FileNotFoundException- if any.
-
getNSClientCollection
public NsclientCollection getNSClientCollection(String collectionName)
getNSClientCollection
- Parameters:
collectionName- aStringobject.- Returns:
- a
org.opennms.netmgt.config.nsclient.NsclientCollectionobject.
-
getRrdRepository
public RrdRepository getRrdRepository(String collectionName)
getRrdRepository
- Parameters:
collectionName- aStringobject.- Returns:
- a
RrdRepositoryobject.
-
getStep
public int getStep(String cName)
getStep
- Parameters:
cName- aStringobject.- Returns:
- a int.
-
updateFromFile
protected void updateFromFile() throws IOExceptionReload the nsclient-datacollection-config.xml file if it has been changed since we last read it.- Throws:
IOException- if any.
-
-