com.raritantechnologies.searchApp
Class ConfigurationManager

java.lang.Object
  extended bycom.raritantechnologies.searchApp.ConfigurationManager
Direct Known Subclasses:
DatabaseConfigurationManager, PropertiesConfigurationManager, XMLConfigurationManager

public abstract class ConfigurationManager
extends java.lang.Object

Manages all configuration issues for a Raritan Technologies Framework application.

Singleton class - Used to set configuration mappings for query processor, search sources, search field map, user interface search forms, display forms etc.

Source of all global parameters for an application. Access to any application-wide attribute is available by obtaining a handle on the ConfigurationManager using:

    ConfigurationManager aConfigManager = ConfigurationManager.getInstance( );
  

ConfigurationManager is an abstract base class. Each Raritan Application Frameworks requires a specific subclass of ConfigurationManager. The implementation classes are responsible for initialization of all application configuration properties. The XMLConfigurationManager is a subclass which initializes configuration settings from an XML Configuration file.


Developed by Raritan Technologies .

Author:
Ted Sullivan, Glenn Robitaille, Jim Nicholson

Field Summary
static java.lang.String DEFAULT_FEDERATOR_CLASS
           
protected  Scheduler theScheduler
           
protected  ISourceMapFactory theSourceMapFactory
           
 
Constructor Summary
protected ConfigurationManager()
           
 
Method Summary
 void addSecurityManager(java.lang.String name, ISecurityManager secManager)
           
 void addSourceMap(ISourceMap theSourceMap, java.lang.String sourceMapName, java.lang.String objectType)
           
 void addSystemObject(java.lang.String type, java.lang.String name, java.lang.Object object)
           
 java.lang.String changeBasePath(java.lang.String pathStr)
           
 java.lang.String changeToSysPathSep(java.lang.String pathStr)
           
protected  boolean createSystemObject(java.lang.String name)
           
 AbstractSearchField getAbstractSearchField(java.lang.String fieldID)
           
 java.lang.String getBasePath()
           
 java.lang.String getConfigPath(java.lang.String sourceName)
          Returns the path where local configuration files are stored for this SearchSource (if any )
 java.lang.String getConfigPath(java.lang.String sourceName, boolean returnUserDirIfNull)
           
static java.io.Writer getDebugWriter()
           
 java.lang.String getFederatorClass()
           
static ConfigurationManager getInstance()
          Singleton pattern access method.
static ConfigurationManager getInstance(java.lang.String useBasePath)
          Overloaded method that takes a basePath string.
 Logger getLogger()
          Returns a Logger instance.
 java.lang.String getLoginPath()
           
static java.util.PropertyResourceBundle getPrb()
           
abstract  IQueryProcessor getQueryProcessor(java.lang.String sourceType)
          Returns an instance of an IQueryProcessor for a particular type of search source.
 Scheduler getScheduler()
           
 ISearchFieldMap getSearchFieldMap()
           
abstract  ISearchFieldMapFactory getSearchFieldMapFactory()
          returns an instance of a SearchFieldMap Factory object.
 SourceLoginInfo[] getSearchSources(ILoginInfo userInfo, java.lang.String sourceType)
          Returns an array of SearchSource objects for a particular type of search.
abstract  ISecurityManager getSecurityManager()
          returns an instance of the ISecurityManager that is used with this configuration.
 ISecurityManager getSecurityManager(java.lang.String securityManagerName)
           
 ISourceMap getSourceMap(java.lang.String objectType)
           
 ISourceMap getSourceMap(java.lang.String sourceMapName, java.lang.String objectType)
          returns an ISourceMap for a given sourceMapName and an object type (aka 'category' )
abstract  ISourceMapFactory getSourceMapFactory()
           
 IStreamFactory getStreamFactory()
           
 java.lang.String getSysConfigProperty(java.lang.String propName)
          Get system configuration property.
 java.lang.Object getSystemObject(java.lang.String type, java.lang.String name)
           
 java.util.Map getSystemObjects(java.lang.String type)
           
protected abstract  void initialize(java.util.PropertyResourceBundle prb)
           
static void initializeLog4JLogging()
          Static method that should be used for all DEBUG messages.
static void initializeLogger(java.lang.String loggerName, java.lang.String loggerElem)
           
static void listSystemProperties(java.io.PrintStream out)
           
static void printStackTrace(java.lang.Throwable e)
           
protected  java.lang.Object returnConfiguredObject(java.lang.String type, java.lang.String name, java.lang.Object sysObject)
           
 void setFederatorClass(java.lang.String federatorClass)
           
static void setStreamFactory(IStreamFactory factory)
           
static void useLog4JLogging()
           
static void write(java.lang.String logger, java.lang.String debugMessage)
           
static void writeDebug(java.lang.Class sourceClass, java.lang.String debugMessage)
           
static void writeDebug(java.lang.Class sourceClass, java.lang.String debugMessage, java.lang.Throwable E)
           
static void writeDebug(java.lang.Object sourceObj, java.lang.String debugMessage)
           
static void writeDebug(java.lang.Object sourceObj, java.lang.String debugMessage, java.lang.Throwable E)
           
static void writeDebug(java.lang.String debugMessage)
           
static void writeError(java.lang.Class sourceClass, java.lang.String errorMessage)
           
static void writeError(java.lang.Class sourceClass, java.lang.String errorMessage, java.lang.Throwable E)
          Method to support log4j syntax that allows exceptions to be included in log messages.
static void writeError(java.lang.Object sourceObj, java.lang.String errorMessage)
           
static void writeError(java.lang.Object sourceObj, java.lang.String errorMessage, java.lang.Throwable e)
           
static void writeError(java.lang.String errorMessage)
           
static void writeFatal(java.lang.Class sourceClass, java.lang.String fatalMessage)
           
static void writeFatal(java.lang.Class sourceClass, java.lang.String fatalMessage, java.lang.Throwable E)
          Method to support log4j syntax that allows exceptions to be included in log messages.
static void writeFatal(java.lang.Object sourceObj, java.lang.String fatalMessage)
           
static void writeFatal(java.lang.Object sourceObj, java.lang.String fatalMessage, java.lang.Throwable e)
           
static void writeFatal(java.lang.String fatalMessage)
           
static void writeInfo(java.lang.Class sourceClass, java.lang.String infoMessage)
           
static void writeInfo(java.lang.Object sourceObj, java.lang.String infoMessage)
           
static void writeInfo(java.lang.String infoMessage)
           
static void writeWarning(java.lang.Class sourceClass, java.lang.String warningMessage)
           
static void writeWarning(java.lang.Object sourceObj, java.lang.String warningMessage)
           
static void writeWarning(java.lang.String warningMessage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theSourceMapFactory

protected ISourceMapFactory theSourceMapFactory

theScheduler

protected Scheduler theScheduler

DEFAULT_FEDERATOR_CLASS

public static final java.lang.String DEFAULT_FEDERATOR_CLASS
See Also:
Constant Field Values
Constructor Detail

ConfigurationManager

protected ConfigurationManager()
Method Detail

getInstance

public static ConfigurationManager getInstance()
Singleton pattern access method. The class to be instantiated is set in the Config.properties file which should be installed in the classpath.


getInstance

public static ConfigurationManager getInstance(java.lang.String useBasePath)
Overloaded method that takes a basePath string.


initialize

protected abstract void initialize(java.util.PropertyResourceBundle prb)

getPrb

public static java.util.PropertyResourceBundle getPrb()

listSystemProperties

public static void listSystemProperties(java.io.PrintStream out)

getDebugWriter

public static java.io.Writer getDebugWriter()

initializeLog4JLogging

public static void initializeLog4JLogging()
Static method that should be used for all DEBUG messages. TODO Add Config.properties DEBUG_FILE line. If present, create a PrintWriter and use that to send DEBUG messages...


useLog4JLogging

public static void useLog4JLogging()

initializeLogger

public static void initializeLogger(java.lang.String loggerName,
                                    java.lang.String loggerElem)

write

public static void write(java.lang.String logger,
                         java.lang.String debugMessage)

writeDebug

public static void writeDebug(java.lang.String debugMessage)

writeDebug

public static void writeDebug(java.lang.Object sourceObj,
                              java.lang.String debugMessage)

writeDebug

public static void writeDebug(java.lang.Class sourceClass,
                              java.lang.String debugMessage)

writeDebug

public static void writeDebug(java.lang.Object sourceObj,
                              java.lang.String debugMessage,
                              java.lang.Throwable E)

writeDebug

public static void writeDebug(java.lang.Class sourceClass,
                              java.lang.String debugMessage,
                              java.lang.Throwable E)

writeInfo

public static void writeInfo(java.lang.String infoMessage)

writeInfo

public static void writeInfo(java.lang.Object sourceObj,
                             java.lang.String infoMessage)

writeInfo

public static void writeInfo(java.lang.Class sourceClass,
                             java.lang.String infoMessage)

writeWarning

public static void writeWarning(java.lang.String warningMessage)

writeWarning

public static void writeWarning(java.lang.Object sourceObj,
                                java.lang.String warningMessage)

writeWarning

public static void writeWarning(java.lang.Class sourceClass,
                                java.lang.String warningMessage)

writeError

public static void writeError(java.lang.String errorMessage)

writeError

public static void writeError(java.lang.Object sourceObj,
                              java.lang.String errorMessage)

writeError

public static void writeError(java.lang.Object sourceObj,
                              java.lang.String errorMessage,
                              java.lang.Throwable e)

writeError

public static void writeError(java.lang.Class sourceClass,
                              java.lang.String errorMessage)

writeError

public static void writeError(java.lang.Class sourceClass,
                              java.lang.String errorMessage,
                              java.lang.Throwable E)
Method to support log4j syntax that allows exceptions to be included in log messages.

Parameters:
E -

writeFatal

public static void writeFatal(java.lang.String fatalMessage)

writeFatal

public static void writeFatal(java.lang.Object sourceObj,
                              java.lang.String fatalMessage)

writeFatal

public static void writeFatal(java.lang.Object sourceObj,
                              java.lang.String fatalMessage,
                              java.lang.Throwable e)

writeFatal

public static void writeFatal(java.lang.Class sourceClass,
                              java.lang.String fatalMessage)

writeFatal

public static void writeFatal(java.lang.Class sourceClass,
                              java.lang.String fatalMessage,
                              java.lang.Throwable E)
Method to support log4j syntax that allows exceptions to be included in log messages.

Parameters:
fatalMessage -
E -

printStackTrace

public static void printStackTrace(java.lang.Throwable e)

getSysConfigProperty

public java.lang.String getSysConfigProperty(java.lang.String propName)
Get system configuration property.

Parameters:
propName - The name of the system configuration property.
Returns:
String containing the value of the system configuration property requested or null if no property found.

getConfigPath

public java.lang.String getConfigPath(java.lang.String sourceName)
Returns the path where local configuration files are stored for this SearchSource (if any )


getConfigPath

public java.lang.String getConfigPath(java.lang.String sourceName,
                                      boolean returnUserDirIfNull)

getLoginPath

public java.lang.String getLoginPath()

changeBasePath

public java.lang.String changeBasePath(java.lang.String pathStr)

changeToSysPathSep

public java.lang.String changeToSysPathSep(java.lang.String pathStr)

getBasePath

public java.lang.String getBasePath()

getQueryProcessor

public abstract IQueryProcessor getQueryProcessor(java.lang.String sourceType)
Returns an instance of an IQueryProcessor for a particular type of search source.

Parameters:
sourceType - Identifies the processor to be used for a particular type of search.

getSearchSources

public SourceLoginInfo[] getSearchSources(ILoginInfo userInfo,
                                          java.lang.String sourceType)
Returns an array of SearchSource objects for a particular type of search.

Parameters:
sourceType - Identifies the processor to be used for a particular type of search.

getSecurityManager

public abstract ISecurityManager getSecurityManager()
returns an instance of the ISecurityManager that is used with this configuration. This allows for the security implementation to change.


getSecurityManager

public ISecurityManager getSecurityManager(java.lang.String securityManagerName)

addSecurityManager

public void addSecurityManager(java.lang.String name,
                               ISecurityManager secManager)

getLogger

public Logger getLogger()
Returns a Logger instance.


getAbstractSearchField

public AbstractSearchField getAbstractSearchField(java.lang.String fieldID)

getSearchFieldMapFactory

public abstract ISearchFieldMapFactory getSearchFieldMapFactory()
returns an instance of a SearchFieldMap Factory object.


getSearchFieldMap

public ISearchFieldMap getSearchFieldMap()

getSourceMapFactory

public abstract ISourceMapFactory getSourceMapFactory()

getSourceMap

public ISourceMap getSourceMap(java.lang.String objectType)
Parameters:
objectType - - type of SourceMap

getSourceMap

public ISourceMap getSourceMap(java.lang.String sourceMapName,
                               java.lang.String objectType)
returns an ISourceMap for a given sourceMapName and an object type (aka 'category' )


addSourceMap

public void addSourceMap(ISourceMap theSourceMap,
                         java.lang.String sourceMapName,
                         java.lang.String objectType)

addSystemObject

public void addSystemObject(java.lang.String type,
                            java.lang.String name,
                            java.lang.Object object)

getSystemObjects

public java.util.Map getSystemObjects(java.lang.String type)

getSystemObject

public java.lang.Object getSystemObject(java.lang.String type,
                                        java.lang.String name)

returnConfiguredObject

protected java.lang.Object returnConfiguredObject(java.lang.String type,
                                                  java.lang.String name,
                                                  java.lang.Object sysObject)

createSystemObject

protected boolean createSystemObject(java.lang.String name)

setStreamFactory

public static void setStreamFactory(IStreamFactory factory)

getStreamFactory

public IStreamFactory getStreamFactory()

setFederatorClass

public void setFederatorClass(java.lang.String federatorClass)

getFederatorClass

public java.lang.String getFederatorClass()

getScheduler

public Scheduler getScheduler()