|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.config.CategoryFactory
public final class 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.
| Constructor Summary | |
|---|---|
CategoryFactory(Reader reader)
|
|
| Method Summary | |
|---|---|
boolean |
addCategory(String groupname,
Category cat)
Add category to a categorygroup. |
void |
addCategoryGroup(Categorygroup group)
Add a categorygroup. |
boolean |
deleteCategory(String groupname,
Category cat)
Delete category from a categorygroup. |
boolean |
deleteCategory(String groupname,
String catlabel)
Delete category from a categorygroup. |
boolean |
deleteCategoryGroup(Categorygroup group)
Delete a categorygroup. |
boolean |
deleteCategoryGroup(String groupname)
Delete a categorygroup. |
Category |
getCategory(String name)
Return the category specified by name. |
Catinfo |
getConfig()
Return the categories configuration. |
String |
getEffectiveRule(String catlabel)
Return the effective rule for the specified category. |
static CatFactory |
getInstance()
Return the singleton instance of this factory. |
double |
getNormal(String catlabel)
Return the normal value for the specified category. |
String |
getRule(String catlabel)
Return the rule for the specified category. |
String[] |
getServices(String catlabel)
Return the services list for the specified category. |
double |
getWarning(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(String groupname,
Category cat)
Replace category in a categorygroup. |
boolean |
replaceCategoryGroup(Categorygroup group)
Replace categorygroup. |
static void |
setInstance(CatFactory singleton)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CategoryFactory(Reader reader)
throws IOException,
org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
IOException
org.exolab.castor.xml.MarshalException
org.exolab.castor.xml.ValidationException| Method Detail |
|---|
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.
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.public static CatFactory getInstance()
IllegalStateException - Thrown if the factory has not yet been initialized.public static void setInstance(CatFactory singleton)
public Catinfo getConfig()
getConfig in interface CatFactorypublic 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(String groupname)
groupname - category group to be removed
public boolean addCategory(String groupname,
Category cat)
groupname - category group to which category is to be addedcat - category to be added
public boolean replaceCategory(String groupname,
Category cat)
groupname - category group to which category is to be addedcat - category to be replaced
public boolean deleteCategory(String groupname,
Category cat)
groupname - category group from which category is to be removedcat - category to be deleted
public boolean deleteCategory(String groupname,
String catlabel)
groupname - category group from which category is to be removedcatlabel - label of the category to be deleted
public Category getCategory(String name)
getCategory in interface CatFactorypublic double getNormal(String catlabel)
getNormal in interface CatFactorycatlabel - the label for the category whose normal value is needed
public double getWarning(String catlabel)
getWarning in interface CatFactorycatlabel - the label for the category whose warning value is needed
public String[] getServices(String catlabel)
catlabel - the label for the category whose services list is needed
public String getRule(String catlabel)
catlabel - the label for the category whose services list is needed
public String getEffectiveRule(String catlabel)
getEffectiveRule in interface CatFactorycatlabel - the label for the category whose effective rule is needed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||