public class TopiaApplicationContextCache extends Object
This class will provide a TopiaApplicationContext cache. Its usage is not necessary, contexts can be directly created outside of this cache, then the cache will not contain any reference to the created ApplicationContexts.
This class is 'inspired' from the TopiaContextFactory of ToPIA 2.x
| Modifier and Type | Field and Description |
|---|---|
protected static Map<Properties,TopiaApplicationContext> |
contextCache
Cache that contains all some already registered caches
|
| Constructor and Description |
|---|
TopiaApplicationContextCache() |
| Modifier and Type | Method and Description |
|---|---|
static <C extends TopiaApplicationContext> |
getContext(Properties config,
com.google.common.base.Function<Properties,C> createContextFunction)
Static method that can provide an ApplicationContext.
|
static List<String> |
getRegisteredContextUrls()
Method to get the list of contexts in memory (each context is identified by its URL).
|
static void |
removeContext(TopiaApplicationContext context)
Remove the given TopiaApplicationContext from the registered ones
|
protected static Map<Properties,TopiaApplicationContext> contextCache
public static <C extends TopiaApplicationContext> C getContext(Properties config, com.google.common.base.Function<Properties,C> createContextFunction)
C - the type of TopiaApplicationContext you expectconfig - the configuration of the contextcreateContextFunction - the function that will be in charge of the context creation. It might not be used
inside the method if the context is found and still openedpublic static List<String> getRegisteredContextUrls()
public static void removeContext(TopiaApplicationContext context)
context - the context instance to removeCopyright © 2004–2015 CodeLutin. All rights reserved.