org.eclipse.emf.validation.model
Class CategoryManager

java.lang.Object
  extended by org.eclipse.emf.validation.model.CategoryManager

public class CategoryManager
extends Object

Central point by which clients discover the available categories and constraints in the system. The CategoryManager is responsible for loading and maintaining all Category instances.

This class is intended to be used by clients of the validation framework.


Method Summary
 Category findCategory(Category parent, String path)
          Finds the category that has the specified path relative to the specified parent category.
 Category findCategory(String path)
          Finds the category that has the specified absolute path.
 Category getCategory(Category parent, String path)
          Obtains the category that has the specified path relative to the specified parent category.
 Category getCategory(String path)
          Obtains the category that has the specified absolute path.
 Category getDefaultCategory()
          Retrieves the default category which contains all constraints that are not explicitly categorized.
static CategoryManager getInstance()
          Obtains the singleton instance of this class.
 Collection<Category> getMandatoryCategories()
          Obtains all of the mandatory categories.
 SortedSet<Category> getTopLevelCategories()
          The top-level categories.
 void removeCategory(Category category)
          Removes the specified category from the category manager.
 void removeCategory(String path)
          Removes the specified category from the category manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CategoryManager getInstance()
Obtains the singleton instance of this class.

Returns:
the category manager instance

getTopLevelCategories

public SortedSet<Category> getTopLevelCategories()
The top-level categories.

Returns:
an unmodifiable set of Categorys, sorted by their names

getDefaultCategory

public Category getDefaultCategory()
Retrieves the default category which contains all constraints that are not explicitly categorized.

Returns:
the default category

getCategory

public Category getCategory(String path)
Obtains the category that has the specified absolute path. If this category does not yet exist, it is implicitly created.

Parameters:
path - the absolute path of the category
Returns:
the specified category (never null)

getCategory

public Category getCategory(Category parent,
                            String path)
Obtains the category that has the specified path relative to the specified parent category. If this category does not yet exist, it is implicitly created.

Parameters:
parent - the parent category, or null to indicate that the path is absolute
path - the path relative to the parent, or the absolute path if parent == null
Returns:
the specified category (never null)

findCategory

public Category findCategory(String path)
Finds the category that has the specified absolute path. Unlike the getCategory(String) method, this method will not implictly create the sought-after category.

Parameters:
path - the absolute path of the category
Returns:
the specified category or null if it is not found

findCategory

public Category findCategory(Category parent,
                             String path)
Finds the category that has the specified path relative to the specified parent category. Unlike the getCategory(Category, String) method, this method will not implictly create the sought-after category.

Parameters:
parent - the parent category, or null to indicate that the path is absolute
path - the path relative to the parent, or the absolute path if parent == null
Returns:
the specified category or null if it is not found

removeCategory

public void removeCategory(Category category)
Removes the specified category from the category manager.

Use extreme caution when invoking this method. This method recursively removes all descendent categories and their constraint from the category manager. The constraints will still operate as they did previously, but the user will not see them in the UI or be able to control their enablement. In general, you should only remove categories that you have added and whose constraints you control.

Parameters:
category - the category to remove
See Also:
removeCategory(String)

removeCategory

public void removeCategory(String path)
Removes the specified category from the category manager.

Use extreme caution when invoking this method. This method recursively removes all descendent categories and their constraint from the category manager. The constraints will still operate as they did previously, but the user will not see them in the UI or be able to control their enablement. In general, you should only remove categories that you have added and whose constraints you control.

Parameters:
path - the ID path of the category to remove
See Also:
removeCategory(Category)

getMandatoryCategories

public Collection<Category> getMandatoryCategories()
Obtains all of the mandatory categories.

Returns:
the mandatory categories

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.