org.kuali.rice.core.config
Class RiceConfigurerBase

java.lang.Object
  extended by org.kuali.rice.core.lifecycle.BaseLifecycle
      extended by org.kuali.rice.core.lifecycle.BaseCompositeLifecycle
          extended by org.kuali.rice.core.config.RiceConfigurerBase
All Implemented Interfaces:
EventListener, Configurer, Lifecycle, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener
Direct Known Subclasses:
RiceConfigurer, ThinClientKEWConfigurer

public abstract class RiceConfigurerBase
extends BaseCompositeLifecycle
implements Configurer, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationListener, org.springframework.beans.factory.BeanFactoryAware

A common base class that can be used to implement classes which are used to configure various Kuali Rice instances.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
private  List<String> additionalSpringFiles
           
private  org.springframework.beans.factory.BeanFactory beanFactory
           
private  List<String> configLocations
           
private  String environment
           
private static org.apache.log4j.Logger LOG
           
private  List<ModuleConfigurer> modules
           
private  Properties properties
           
private  Config rootConfig
           
private  ResourceLoader rootResourceLoader
           
private  String serviceNamespace
           
 
Constructor Summary
RiceConfigurerBase()
           
 
Method Summary
protected  void addModulesResourceLoaders()
          This method decides the sequence of module resource loaders to be added to global resource loader (GRL).
 void afterPropertiesSet()
           
protected  void configureEnvironment(Config config)
           
protected  void configureServiceNamespace(Config config)
           
 void destroy()
           
 List<String> getAdditionalSpringFiles()
           
 org.springframework.beans.factory.BeanFactory getBeanFactory()
           
 List<String> getConfigLocations()
           
 String getEnvironment()
           
 List<ModuleConfigurer> getModules()
           
 Properties getProperties()
           
 Config getRootConfig()
           
 ResourceLoader getRootResourceLoader()
           
 String getServiceNamespace()
           
protected  void initializeBaseConfiguration(Config currentConfig)
          Initializes any base parameters within the Rice configuration system.
protected  void initializeFullConfiguration()
           
private  void initializeResourceLoaders()
          This method initializes root resource loader and spring context.
protected  boolean isConfigureLogging()
           
protected  List<Lifecycle> loadLifecycles()
           
 ResourceLoader loadSpringContext()
          This method: 1) Creates a spring application context, using the spring files from the modules.
protected  void notify(RiceConfigEvent event)
           
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
protected  Config parseConfig()
           
protected  void parseModuleConfigs(Config rootConfig)
           
 void setAdditionalSpringFiles(List<String> additionalSpringFiles)
           
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setConfigLocations(List<String> configLocations)
           
 void setEnvironment(String environment)
           
 void setModules(List<ModuleConfigurer> modules)
           
 void setProperties(Properties properties)
           
 void setRootConfig(Config rootConfig)
           
 void setRootResourceLoader(ResourceLoader rootResourceLoader)
           
 void setServiceNamespace(String ServiceNamespace)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.kuali.rice.core.lifecycle.BaseLifecycle
isStarted, setStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.core.lifecycle.Lifecycle
isStarted
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

environment

private String environment

serviceNamespace

private String serviceNamespace

rootConfig

private Config rootConfig

rootResourceLoader

private ResourceLoader rootResourceLoader

properties

private Properties properties

configLocations

private List<String> configLocations

additionalSpringFiles

private List<String> additionalSpringFiles

beanFactory

private org.springframework.beans.factory.BeanFactory beanFactory

modules

private List<ModuleConfigurer> modules
Constructor Detail

RiceConfigurerBase

public RiceConfigurerBase()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception
See Also:
DisposableBean.destroy()

start

public void start()
           throws Exception
Specified by:
start in interface Lifecycle
Overrides:
start in class BaseCompositeLifecycle
Throws:
Exception
See Also:
BaseCompositeLifecycle.start()

initializeResourceLoaders

private void initializeResourceLoaders()
                                throws Exception
This method initializes root resource loader and spring context.

Throws:
Exception

addModulesResourceLoaders

protected void addModulesResourceLoaders()
                                  throws Exception
This method decides the sequence of module resource loaders to be added to global resource loader (GRL). It asks the individual module configurers for the resource loader they want to register and adds them to GRL.

The default implementation loops over the list of modules and gets the resource loader to register for each one.

Throws:
Exception

loadSpringContext

public ResourceLoader loadSpringContext()
                                 throws Exception
This method: 1) Creates a spring application context, using the spring files from the modules. 2) Wraps the context in a ResourceLoader and adds it to GRL.

Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Lifecycle
Overrides:
stop in class BaseCompositeLifecycle
Throws:
Exception
See Also:
BaseCompositeLifecycle.stop()

loadLifecycles

protected List<Lifecycle> loadLifecycles()
                                  throws Exception
Specified by:
loadLifecycles in class BaseCompositeLifecycle
Throws:
Exception
See Also:
BaseCompositeLifecycle.loadLifecycles()

isConfigureLogging

protected boolean isConfigureLogging()

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener
See Also:
ApplicationListener.onApplicationEvent(org.springframework.context.ApplicationEvent)

notify

protected void notify(RiceConfigEvent event)
               throws Exception
Throws:
Exception

initializeFullConfiguration

protected void initializeFullConfiguration()
                                    throws Exception
Throws:
Exception

initializeBaseConfiguration

protected void initializeBaseConfiguration(Config currentConfig)
                                    throws Exception
Initializes any base parameters within the Rice configuration system. Generally, this is used to put properties that are injected into this configurer into the Rice ConfigContext.

This superclass configures the environment code, subclasses can override this but should be sure to call super.initializeBaseConfiguration.

Throws:
Exception

parseConfig

protected Config parseConfig()
                      throws Exception
Throws:
Exception

parseModuleConfigs

protected void parseModuleConfigs(Config rootConfig)
                           throws Exception
Throws:
Exception

configureEnvironment

protected void configureEnvironment(Config config)

configureServiceNamespace

protected void configureServiceNamespace(Config config)

getEnvironment

public String getEnvironment()

setEnvironment

public void setEnvironment(String environment)

getServiceNamespace

public String getServiceNamespace()

setServiceNamespace

public void setServiceNamespace(String ServiceNamespace)

getRootResourceLoader

public ResourceLoader getRootResourceLoader()

setRootResourceLoader

public void setRootResourceLoader(ResourceLoader rootResourceLoader)

getProperties

public Properties getProperties()

setProperties

public void setProperties(Properties properties)

getConfigLocations

public List<String> getConfigLocations()

setConfigLocations

public void setConfigLocations(List<String> configLocations)

getRootConfig

public Config getRootConfig()

setRootConfig

public void setRootConfig(Config rootConfig)

getModules

public List<ModuleConfigurer> getModules()
Returns:
the modules

setModules

public void setModules(List<ModuleConfigurer> modules)
Parameters:
modules - the modules to set

getAdditionalSpringFiles

public List<String> getAdditionalSpringFiles()
Returns:
the additionalSpringFiles

setAdditionalSpringFiles

public void setAdditionalSpringFiles(List<String> additionalSpringFiles)
Parameters:
additionalSpringFiles - the additionalSpringFiles to set. list members can be filenames, or comma separated lists of filenames.

getBeanFactory

public org.springframework.beans.factory.BeanFactory getBeanFactory()

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.