public class CollectdConfigFactory extends Object
Constructor and Description |
---|
CollectdConfigFactory(InputStream stream,
String localServer,
boolean verifyServer)
Constructor for CollectdConfigFactory.
|
Modifier and Type | Method and Description |
---|---|
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
|
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.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 readorg.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/loadedorg.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 checkpublic boolean domainExists(String name)
name
- The domain name to checkpublic boolean isServiceCollectionEnabled(String ipAddr, String svcName)
ipAddr
- IP address of the interface to lookupsvcName
- The service name to lookupCopyright © 2015. All Rights Reserved.