Package com.logicaldoc.util
Class Context
- java.lang.Object
- 
- com.logicaldoc.util.Context
 
- 
- All Implemented Interfaces:
- EventListener,- org.springframework.beans.factory.Aware,- org.springframework.context.ApplicationContextAware,- org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
 
 public class Context extends Object implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent> Utility class collecting static methods related to spring's context.- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddListener(SystemEventListener evt)Adds an Listener to a particular Event given fromvoidclose()Closes this contextstatic Contextget()ObjectgetBean(Class clazz)Retrieves a bean registered in the Spring context using a class name.ObjectgetBean(String id)Retrieves a bean registered in the Spring context.List<String>getBeanIds()Retrieves the collection of all the bean idsList<Object>getBeansOfType(Class clazz)Retrieves the list of bean of the same typeContextPropertiesgetProperties()Gets the registry with all the configuration properties for this contextorg.springframework.core.io.ResourcegetResource(String resourceLocation)Returns a Spring-Resourceorg.springframework.core.io.Resource[]getResources(String resourcePattern)voidonApplicationEvent(org.springframework.context.ApplicationEvent event)Processes a newly incoming event on appropriated events that registered itself on itstatic voidrefresh()Reloads the Spring application context.static voidremoveListener(SystemEventListener evt)Removes a particular Listener from the listvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
 
- 
- 
- 
Method Detail- 
getpublic static Context get() 
 - 
getPropertiespublic ContextProperties getProperties() Gets the registry with all the configuration properties for this context- Returns:
- the instance of ContextProperties in the application context
 
 - 
setApplicationContextpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException- Specified by:
- setApplicationContextin interface- org.springframework.context.ApplicationContextAware
- Throws:
- org.springframework.beans.BeansException
 
 - 
getBeanpublic Object getBean(String id) Retrieves a bean registered in the Spring context.- Parameters:
- id- The bean identifier
- Returns:
- The bean instance
 
 - 
getBeanIdspublic List<String> getBeanIds() Retrieves the collection of all the bean ids- Returns:
- the collection of ids of all the beans available in the application context
 
 - 
getBeansOfTypepublic List<Object> getBeansOfType(Class clazz) Retrieves the list of bean of the same type- Parameters:
- clazz- class to use as filter
- Returns:
- the collection of bean instances
 
 - 
getBeanpublic Object getBean(Class clazz) Retrieves a bean registered in the Spring context using a class name. At first the fully qualified class name is checked, then if nothing was found the simple class name is used as bean id.- Parameters:
- clazz- The bean identifier as class name
- Returns:
- The bean instance
 
 - 
refreshpublic static void refresh() Reloads the Spring application context.NOTE: use carefully, invoke only during setup when the config.xml is changed 
 - 
addListenerpublic static void addListener(SystemEventListener evt) Adds an Listener to a particular Event given from- Parameters:
- evt- the listener
- See Also:
- SystemEventListener.getSystemStatus()
 
 - 
removeListenerpublic static void removeListener(SystemEventListener evt) Removes a particular Listener from the list- Parameters:
- evt- the system event
 
 - 
getResourcespublic org.springframework.core.io.Resource[] getResources(String resourcePattern) 
 - 
getResourcepublic org.springframework.core.io.Resource getResource(String resourceLocation) Returns a Spring-Resource- Parameters:
- resourceLocation- name of the resource to retrieve
- Returns:
- the resource instance
 
 - 
onApplicationEventpublic void onApplicationEvent(org.springframework.context.ApplicationEvent event) Processes a newly incoming event on appropriated events that registered itself on it- Specified by:
- onApplicationEventin interface- org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>
- Parameters:
- event- the event to process
 
 - 
closepublic void close() Closes this context
 
- 
 
-