|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opennms.netmgt.config.CollectdConfigFactory
public class CollectdConfigFactory
This is the singleton class used to load the configuration for the OpenNMS Collection Daemon from the collectd-configuration xml file. A mapping of the configured URLs to the iplist they contain is built at init() time so as to avoid numerous file reads. 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.
| Constructor Summary | |
|---|---|
CollectdConfigFactory(InputStream stream,
String localServer,
boolean verifyServer)
Constructor for CollectdConfigFactory. |
|
CollectdConfigFactory(Reader rdr,
String localServer,
boolean verifyServer)
Public constructor |
|
| Method Summary | |
|---|---|
boolean |
domainExists(String name)
Returns true if collection domain exists |
CollectdConfig |
getCollectdConfig()
getCollectdConfig |
static CollectdConfigFactory |
getInstance()
Return the singleton instance of this factory. |
CollectdPackage |
getPackage(String name)
getPackage |
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
boolean |
isServiceCollectionEnabled(String ipAddr,
String svcName)
Returns true if the specified interface is included by at least one package which has the specified service and that service is enabled (set to "on"). |
boolean |
packageExists(String name)
Returns true if collection package exists |
void |
rebuildPackageIpListMap()
This method is used to rebuild the package agaist iplist mapping when needed. |
static void |
reload()
Reload the config from the default config file |
void |
saveCurrent()
Saves the current in-memory configuration to disk and reloads |
static void |
setInstance(CollectdConfigFactory instance)
setInstance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CollectdConfigFactory(Reader rdr,
String localServer,
boolean verifyServer)
throws IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
rdr - a Reader object.localServer - a String object.verifyServer - a boolean.
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.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
public CollectdConfigFactory(InputStream stream,
String localServer,
boolean verifyServer)
throws org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
Constructor for CollectdConfigFactory.
stream - a InputStream object.localServer - a String object.verifyServer - a boolean.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.| Method Detail |
|---|
public void rebuildPackageIpListMap()
public static void init()
throws IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
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.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
public static void reload()
throws IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
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.
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
public void saveCurrent()
throws org.exolab.castor.xml.MarshalException,
IOException,
org.exolab.castor.xml.ValidationException
org.exolab.castor.xml.MarshalException - if any.
IOException - if any.
org.exolab.castor.xml.ValidationException - if any.public static CollectdConfigFactory getInstance()
IllegalStateException - Thrown if the factory has not yet been initialized.public static void setInstance(CollectdConfigFactory instance)
setInstance
instance - a CollectdConfigFactory object.public CollectdConfig getCollectdConfig()
getCollectdConfig
CollectdConfig object.public CollectdPackage getPackage(String name)
getPackage
name - a String object.
CollectdPackage object.public boolean packageExists(String name)
name - The package name to check
public boolean domainExists(String name)
name - The domain name to check
public boolean isServiceCollectionEnabled(String ipAddr,
String svcName)
ipAddr - IP address of the interface to lookupsvcName - The service name to lookup
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||