org.kuali.kfs.sys.context
Class SpringContext

java.lang.Object
  extended by org.kuali.kfs.sys.context.SpringContext
Direct Known Subclasses:
SpringContextForWorkflowImporter

public class SpringContext
extends Object


Field Summary
protected static String APPLICATION_CONTEXT_DEFINITION
           
protected static org.springframework.context.ConfigurableApplicationContext applicationContext
           
protected static org.apache.log4j.Logger LOG
           
protected static String MEMORY_MONITOR_THRESHOLD_KEY
           
protected static Thread processWatchThread
           
protected static Map<String,Object> SINGLETON_BEANS_BY_NAME_CACHE
           
protected static Map<Class<? extends Object>,Object> SINGLETON_BEANS_BY_TYPE_CACHE
           
protected static Map<Class<? extends Object>,Map> SINGLETON_BEANS_OF_TYPE_CACHE
           
protected static Set<Class<? extends Object>> SINGLETON_TYPES
           
protected static String TEST_CONTEXT_DEFINITION
           
protected static String USE_QUARTZ_SCHEDULING_KEY
           
 
Constructor Summary
SpringContext()
           
 
Method Summary
protected static void close()
           
static
<T> T
getBean(Class<T> type)
          Use this method to retrieve a spring bean when one of the following is the case.
static
<T> T
getBean(Class<T> type, String name)
           
protected static Object getBean(String beanName)
           
protected static String[] getBeanNames()
           
static
<T> Map<String,T>
getBeansOfType(Class<T> type)
          Use this method to retrieve all beans of a give type in our spring context.
static List<org.kuali.rice.kns.util.cache.MethodCacheInterceptor> getMethodCacheInterceptors()
           
static Object getService(String serviceName)
          Use this method to retrieve a service which may or may not be implemented locally.
protected static void initializeApplicationContext()
           
protected static void initializeApplicationContextWithoutSchedule()
           
protected static void initializeBatchApplicationContext()
           
protected static void initializeTestApplicationContext()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.log4j.Logger LOG

APPLICATION_CONTEXT_DEFINITION

protected static final String APPLICATION_CONTEXT_DEFINITION
See Also:
Constant Field Values

TEST_CONTEXT_DEFINITION

protected static final String TEST_CONTEXT_DEFINITION
See Also:
Constant Field Values

MEMORY_MONITOR_THRESHOLD_KEY

protected static final String MEMORY_MONITOR_THRESHOLD_KEY
See Also:
Constant Field Values

USE_QUARTZ_SCHEDULING_KEY

protected static final String USE_QUARTZ_SCHEDULING_KEY
See Also:
Constant Field Values

applicationContext

protected static org.springframework.context.ConfigurableApplicationContext applicationContext

SINGLETON_TYPES

protected static Set<Class<? extends Object>> SINGLETON_TYPES

SINGLETON_BEANS_BY_TYPE_CACHE

protected static Map<Class<? extends Object>,Object> SINGLETON_BEANS_BY_TYPE_CACHE

SINGLETON_BEANS_BY_NAME_CACHE

protected static Map<String,Object> SINGLETON_BEANS_BY_NAME_CACHE

SINGLETON_BEANS_OF_TYPE_CACHE

protected static Map<Class<? extends Object>,Map> SINGLETON_BEANS_OF_TYPE_CACHE

processWatchThread

protected static Thread processWatchThread
Constructor Detail

SpringContext

public SpringContext()
Method Detail

getService

public static Object getService(String serviceName)
Use this method to retrieve a service which may or may not be implemented locally. (That is, defined in the main Spring ApplicationContext created by Rice.


getBean

public static <T> T getBean(Class<T> type)
Use this method to retrieve a spring bean when one of the following is the case. Pass in the type of the service interface, NOT the service implementation. 1. there is only one bean of the specified type in our spring context 2. there is only one bean of the specified type in our spring context, but you want the one whose bean id is the same as type.getSimpleName() with the exception of the first letter being lower case in the former and upper case in the latter, For example, there are two beans of type DateTimeService in our context � dateTimeService and testDateTimeService. To retrieve the former, you should specific DateTimeService.class as the type. To retrieve the latter, you should specify ConfigurableDateService.class as the type. Unless you are writing a unit test and need to down cast to an implementation, you do not need to cast the result of this method.

Type Parameters:
T -
Parameters:
type -
Returns:
an object that has been defined as a bean in our spring context and is of the specified type

getBeansOfType

public static <T> Map<String,T> getBeansOfType(Class<T> type)
Use this method to retrieve all beans of a give type in our spring context. Pass in the type of the service interface, NOT the service implementation.

Type Parameters:
T -
Parameters:
type -
Returns:
a map of the spring bean ids / beans that are of the specified type

getBean

public static <T> T getBean(Class<T> type,
                            String name)

getMethodCacheInterceptors

public static List<org.kuali.rice.kns.util.cache.MethodCacheInterceptor> getMethodCacheInterceptors()

getBean

protected static Object getBean(String beanName)

getBeanNames

protected static String[] getBeanNames()

initializeApplicationContext

protected static void initializeApplicationContext()

initializeApplicationContextWithoutSchedule

protected static void initializeApplicationContextWithoutSchedule()

initializeBatchApplicationContext

protected static void initializeBatchApplicationContext()

initializeTestApplicationContext

protected static void initializeTestApplicationContext()

close

protected static void close()
                     throws Exception
Throws:
Exception


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.