net.firstpartners.rp.mid.category
Class CategoryManager

java.lang.Object
  extended by net.firstpartners.rp.mid.category.CategoryManager
All Implemented Interfaces:
IInterestedInAdd, ICategoryManager, IPlugin

public class CategoryManager
extends java.lang.Object
implements IInterestedInAdd, ICategoryManager

A Category is one set of data within the link KnowledgeSphere. To put it another way, a KnowledgeSphere is made up of many Categories. The CategoryManager makes it easier to deal with all the categories in the system at one.

Version:
1.3
Author:
brownpa, Firstpartners.net

Field Summary
private  java.util.LinkedList categoryList
          List of the category struct objects
private  java.lang.String defaultCategName
          Default category name
protected  org.apache.log4j.Logger logger
          Logger for this class and subclasses
private  int maxLengthCategName
          Maxim length for the category name
private  java.lang.String patternCategName
          Pattern for generation of the category name
private  java.lang.String root
          Category root
private  int systemDepthLevel
          The default system extraction depth
 
Constructor Summary
private CategoryManager()
          Creates a new CategoryManager object.
 
Method Summary
 void addInformation(INewInformation info)
          Add a new piece of information to the system
private  java.lang.String getAndAddUniqueCategoryName(java.lang.String name, java.lang.String location)
          Generate the name for the category using a preselected one .
 java.util.LinkedList getCategoryList()
          Get the category list
private  java.lang.String getCategoryName(java.lang.String location)
          Get the location name upon the info data (specified uri location)
 java.lang.String getDefaultCategName()
          Get the default category name
 int getMaxLengthCategName()
          Get the maxim length for the category name
 java.lang.String getPatternCategName()
          Get the pattern of the category name
 java.lang.String getRoot()
          Get the root folder of the category manager
 int getSystemDepthLevel()
           
 void onLoad()
          Called by the PluginManager on each plugin when this class is first loaded
 void setCategoryList(java.util.LinkedList categoryList)
          Set the category list
 void setDefaultCategName(java.lang.String defaultCategName)
          Set the default category name
 void setMaxLengthCategName(int maxCategLength)
          Set the maxim length for the category name
 void setPatternCategName(java.lang.String patternCategName)
          Set the category name pattern
 void setRoot(java.lang.String root)
          Set the root folder of the plugin manager.
 void setSystemDepthLevel(int systemDepthLevel)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.log4j.Logger logger
Logger for this class and subclasses


root

private java.lang.String root
Category root


defaultCategName

private java.lang.String defaultCategName
Default category name


maxLengthCategName

private int maxLengthCategName
Maxim length for the category name


patternCategName

private java.lang.String patternCategName
Pattern for generation of the category name


categoryList

private java.util.LinkedList categoryList
List of the category struct objects


systemDepthLevel

private int systemDepthLevel
The default system extraction depth

Constructor Detail

CategoryManager

private CategoryManager()
Creates a new CategoryManager object.

Method Detail

onLoad

public void onLoad()
Called by the PluginManager on each plugin when this class is first loaded

Specified by:
onLoad in interface IPlugin

addInformation

public void addInformation(INewInformation info)
                    throws RpException
Add a new piece of information to the system

Specified by:
addInformation in interface IInterestedInAdd
Parameters:
info - Information to be added to the system
Throws:
RpException - Error occur in process the information

getAndAddUniqueCategoryName

private java.lang.String getAndAddUniqueCategoryName(java.lang.String name,
                                                     java.lang.String location)
Generate the name for the category using a preselected one . The name of the category should be unique in the system. In case of the category name already exists, a new generation will occur using the default Category Name specified in the global property file.

Parameters:
name - Name of the category generated upon the information name
location - DOCUMENT ME!
Returns:
Unique name in the system for the category name

getCategoryName

private java.lang.String getCategoryName(java.lang.String location)
Get the location name upon the info data (specified uri location)

Parameters:
location - Uri location
Returns:
Location name for the specified uri location

getCategoryList

public java.util.LinkedList getCategoryList()
Get the category list

Specified by:
getCategoryList in interface ICategoryManager
Returns:
Category list

setCategoryList

public void setCategoryList(java.util.LinkedList categoryList)
Set the category list

Parameters:
categoryList - Category list to set

getDefaultCategName

public java.lang.String getDefaultCategName()
Get the default category name

Returns:
Default category name

setDefaultCategName

public void setDefaultCategName(java.lang.String defaultCategName)
Set the default category name

Parameters:
defaultCategName - Default category name to set

getMaxLengthCategName

public int getMaxLengthCategName()
Get the maxim length for the category name

Returns:
Maxim length for the category name

setMaxLengthCategName

public void setMaxLengthCategName(int maxCategLength)
Set the maxim length for the category name

Parameters:
maxCategLength - Maxim length for category to set

getPatternCategName

public java.lang.String getPatternCategName()
Get the pattern of the category name

Returns:
Category name pattern

setPatternCategName

public void setPatternCategName(java.lang.String patternCategName)
Set the category name pattern

Parameters:
patternCategName - Category name pattern to be used

getRoot

public java.lang.String getRoot()
Get the root folder of the category manager

Specified by:
getRoot in interface ICategoryManager
Returns:
root folder of the category manager

setRoot

public void setRoot(java.lang.String root)
Set the root folder of the plugin manager.

Parameters:
root - Root folder of the plugin manager ti set.

getSystemDepthLevel

public int getSystemDepthLevel()
Returns:
Returns the systemDepthLevel.

setSystemDepthLevel

public void setSystemDepthLevel(int systemDepthLevel)
Parameters:
systemDepthLevel - The systemDepthLevel to set.