org.kuali.rice.core.config
Class ConfigContext

java.lang.Object
  extended by org.kuali.rice.core.config.ConfigContext

public class ConfigContext
extends Object

Singleton that holds references to global engine objects.

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

Field Summary
private static Map<ClassLoader,Config> CONFIGS
           
private static ContextualConfigLock initialized
          Concurrency utility which allows other, loosely coupled, components to wait for configuration initialization to complete before proceeding (namely the SpringServiceLocator, before it initializes Spring)
private static org.apache.log4j.Logger LOG
           
 
Constructor Summary
private ConfigContext()
           
 
Method Summary
static void destroy()
          Destroy method (mostly to aid testing, as core needs to be torn down appropriately).
static Config getConfig(ClassLoader cl)
           
static Set<Map.Entry<ClassLoader,Config>> getConfigs()
           
static Config getCurrentContextConfig()
          Utility method that all code should call to obtain its appropriate Config object.
static ContextualConfigLock getInitializedCondition()
          Returns the Condition that allows waiting on configuration to complete
private static Object getObjectFromClassLoader(String name, ClassLoader classLoader)
           
private static void getObjectFromClassLoader(String name, ClassLoader classLoader, List<Object> objects)
           
static Object getObjectFromConfigHierarchy(String name)
           
static List<Object> getObjectsFromConfigHierarchy(String name)
           
static Config getRootConfig()
          Deprecated. this really isn't working as intended at the moment but it still needs to work the concept of a root config may need to go away
static void init(ClassLoader classLoader, Config config)
          Initializes the ConfigContext with the given Config and binds it to the given ClassLoader.
static void init(Config rootCfg)
          Perform a one-time initialization of the Config system.
static void overrideConfig(ClassLoader cl, Config config)
          Overrides any existing Config for the classloader
static void validateCoreConfiguration()
          Runs a series of validation checks against the core configuration to ensure that required properties are present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

initialized

private static final ContextualConfigLock initialized
Concurrency utility which allows other, loosely coupled, components to wait for configuration initialization to complete before proceeding (namely the SpringServiceLocator, before it initializes Spring)


CONFIGS

private static final Map<ClassLoader,Config> CONFIGS
Constructor Detail

ConfigContext

private ConfigContext()
Method Detail

init

public static void init(Config rootCfg)
Perform a one-time initialization of the Config system. This should only be performed by the applicable LifeCycle implementation.

Parameters:
rootCfg - the root config

init

public static void init(ClassLoader classLoader,
                        Config config)
Initializes the ConfigContext with the given Config and binds it to the given ClassLoader.


destroy

public static void destroy()
Destroy method (mostly to aid testing, as core needs to be torn down appropriately).


getRootConfig

public static Config getRootConfig()
Deprecated. this really isn't working as intended at the moment but it still needs to work the concept of a root config may need to go away

Returns the "root" Config object

Returns:
the "root" Config object

getInitializedCondition

public static ContextualConfigLock getInitializedCondition()
Returns the Condition that allows waiting on configuration to complete

Returns:
the Condition that allows waiting on configuration to complete

validateCoreConfiguration

public static void validateCoreConfiguration()
Runs a series of validation checks against the core configuration to ensure that required properties are present. For now, this just validates the service namespace.


getCurrentContextConfig

public static Config getCurrentContextConfig()
Utility method that all code should call to obtain its appropriate Config object. The Config object which is associated with the caller's context classloader will be returned, being created first if it does not yet exist.

Returns:
the Config object which is associated with the caller's context classloader

getConfig

public static Config getConfig(ClassLoader cl)
Parameters:
cl - the classloader whose Config to return
Returns:
the Config of a particular class loader

getObjectFromConfigHierarchy

public static Object getObjectFromConfigHierarchy(String name)

getObjectFromClassLoader

private static Object getObjectFromClassLoader(String name,
                                               ClassLoader classLoader)

getObjectsFromConfigHierarchy

public static List<Object> getObjectsFromConfigHierarchy(String name)

getObjectFromClassLoader

private static void getObjectFromClassLoader(String name,
                                             ClassLoader classLoader,
                                             List<Object> objects)

getConfigs

public static Set<Map.Entry<ClassLoader,Config>> getConfigs()
Returns:
an immutable view of the Configs entry set

overrideConfig

public static void overrideConfig(ClassLoader cl,
                                  Config config)
Overrides any existing Config for the classloader

Parameters:
cl - the classloader whose Config should be overridden
config - the config


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