|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.config.CategoryFactory
This is the singleton class used to load the configuration from the categories.xml. This provides convenience methods to get the configured categories and their information, add/delete categories from category groups. 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.
Field Summary | |
private Catinfo |
m_config
The config class loaded from the config file |
private static boolean |
m_loaded
This member is set to true if the configuration file has been loaded. |
private static CategoryFactory |
m_singleton
The singleton instance of this factory |
Constructor Summary | |
private |
CategoryFactory(java.lang.String configFile)
Private constructor |
Method Summary | |
boolean |
addCategory(java.lang.String groupname,
Category cat)
Add category to a categorygroup. |
void |
addCategoryGroup(Categorygroup group)
Add a categorygroup. |
boolean |
deleteCategory(java.lang.String groupname,
Category cat)
Delete category from a categorygroup. |
boolean |
deleteCategory(java.lang.String groupname,
java.lang.String catlabel)
Delete category from a categorygroup. |
boolean |
deleteCategoryGroup(Categorygroup group)
Delete a categorygroup. |
boolean |
deleteCategoryGroup(java.lang.String groupname)
Delete a categorygroup. |
Category |
getCategory(java.lang.String name)
Return the category specified by name. |
Catinfo |
getConfig()
Return the categories configuration. |
java.lang.String |
getEffectiveRule(java.lang.String catlabel)
Return the effective rule for the specified category. |
static CategoryFactory |
getInstance()
Return the singleton instance of this factory. |
double |
getNormal(java.lang.String catlabel)
Return the normal value for the specified category. |
java.lang.String |
getRule(java.lang.String catlabel)
Return the rule for the specified category. |
java.lang.String[] |
getServices(java.lang.String catlabel)
Return the services list for the specified category. |
double |
getWarning(java.lang.String catlabel)
Return the warning value for the specified category. |
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
static void |
reload()
Reload the config from the default config file |
boolean |
replaceCategory(java.lang.String groupname,
Category cat)
Replace category in a categorygroup. |
boolean |
replaceCategoryGroup(Categorygroup group)
Replace categorygroup. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static CategoryFactory m_singleton
private Catinfo m_config
private static boolean m_loaded
Constructor Detail |
private CategoryFactory(java.lang.String configFile) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.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.Method Detail |
public static void init() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.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.public static void reload() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.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.public static CategoryFactory getInstance()
java.lang.IllegalStateException
- Thrown if the factory has not yet been initialized.public Catinfo getConfig()
public void addCategoryGroup(Categorygroup group)
group
- category group to be addedpublic boolean replaceCategoryGroup(Categorygroup group)
group
- category group to be replaced
public boolean deleteCategoryGroup(Categorygroup group)
group
- category group to be removed
public boolean deleteCategoryGroup(java.lang.String groupname)
groupname
- category group to be removed
public boolean addCategory(java.lang.String groupname, Category cat)
groupname
- category group to which category is to be addedcat
- category to be added
public boolean replaceCategory(java.lang.String groupname, Category cat)
groupname
- category group to which category is to be addedcat
- category to be replaced
public boolean deleteCategory(java.lang.String groupname, Category cat)
groupname
- category group from which category is to be removedcat
- category to be deleted
public boolean deleteCategory(java.lang.String groupname, java.lang.String catlabel)
groupname
- category group from which category is to be removedcatlabel
- label of the category to be deleted
public Category getCategory(java.lang.String name)
public double getNormal(java.lang.String catlabel)
catlabel
- the label for the category whose normal value is needed
public double getWarning(java.lang.String catlabel)
catlabel
- the label for the category whose warning value is needed
public java.lang.String[] getServices(java.lang.String catlabel)
catlabel
- the label for the category whose services list is needed
public java.lang.String getRule(java.lang.String catlabel)
catlabel
- the label for the category whose services list is needed
public java.lang.String getEffectiveRule(java.lang.String catlabel)
catlabel
- the label for the category whose effective rule is needed
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |