ch.elca.el4j.core.context
Class ModuleApplicationContextUtils

java.lang.Object
  extended by ch.elca.el4j.core.context.ModuleApplicationContextUtils

public class ModuleApplicationContextUtils
extends Object

This class allows excluding some items out of a file list.

Author:
Andreas Bur (ABU)
File-location:
ModuleApplicationContextUtils
Last check-in date:
2010-11-02 11:44:37 +0100 (Di, 02. Nov 2010) by swisswheel for revision 4204

Constructor Summary
ModuleApplicationContextUtils(ApplicationContext context)
          Creates a new instance that is connected to the given application contet.
 
Method Summary
 String[] calculateInputFiles(String[] inclusiveConfigLocations, String[] exclusiveConfigLocations, boolean allowBeanDefinitionOverriding)
          Calculate the array of xml configuration files which are loaded into the ApplicationContext, i.e. exclude the xml files in inclusiveFileNames which are in exclusiveFileNames.
protected  void checkConfigLocations(String configLocation)
          Check whether the 'classpath*:mandatory/*.xml' config location is loaded.
protected  OrderedBeanNameHolder getOrderedBeanNameHolder(ConfigurableListableBeanFactory beanFactory, String orderedBeanName)
          Returns a ordered bean name holder for the given bean.
protected  List<String> getResolvedFileNames(String[] unresolvedFileNames)
          Changes the syntax of the pathnames, i.e. filepaths beginning with "file:$Drive" and not with "file:/$Drive" are changed and "\" characters are changed to "/".
protected  void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory, List<OrderedBeanNameHolder> postProcessorHolders)
          Invoke the given BeanFactoryPostProcessor beans.
 void invokeBeanFactoryPostProcessorsStrictlyOrdered(ConfigurableListableBeanFactory beanFactory)
          All bean factory post processors of the given bean factory will be created and invoked in strict order.
 boolean isReverseConfigLocationResourceArray()
           
protected  String[] resolveAttribute(String path)
          Resolves a path (i.e. file- or classpath) by applying Ant-style path matching.
 void setReverseConfigLocationResourceArray(boolean reverseConfigLocationResourceArray)
          Flag to indicate if the resource array of a config location should be reversed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleApplicationContextUtils

public ModuleApplicationContextUtils(ApplicationContext context)
Creates a new instance that is connected to the given application contet.

Parameters:
context - The application context to connect to.
Method Detail

calculateInputFiles

public String[] calculateInputFiles(String[] inclusiveConfigLocations,
                                    String[] exclusiveConfigLocations,
                                    boolean allowBeanDefinitionOverriding)
Calculate the array of xml configuration files which are loaded into the ApplicationContext, i.e. exclude the xml files in inclusiveFileNames which are in exclusiveFileNames.

Parameters:
inclusiveConfigLocations - array of file paths
exclusiveConfigLocations - array of file paths which are excluded
allowBeanDefinitionOverriding - a boolean which defines if overriding of bean definitions is allowed
Returns:
Returns the adapted list of configuration locations.

checkConfigLocations

protected void checkConfigLocations(String configLocation)
Check whether the 'classpath*:mandatory/*.xml' config location is loaded.

Parameters:
configLocation - The config location

getResolvedFileNames

protected List<String> getResolvedFileNames(String[] unresolvedFileNames)
Changes the syntax of the pathnames, i.e. filepaths beginning with "file:$Drive" and not with "file:/$Drive" are changed and "\" characters are changed to "/". This is necessary for the PathMatchingResourcePatternResolver to resolve ant-style filepaths.

Parameters:
unresolvedFileNames - Are the names of unresolved file names.
Returns:
Returns a list of resolved file names.

resolveAttribute

protected String[] resolveAttribute(String path)
Resolves a path (i.e. file- or classpath) by applying Ant-style path matching. Returns all resolved xml files. A warning will be displayed if a resource does not exist.

Parameters:
path - a path of an xml file, either absolute, relative or Ant-style
Returns:
all resolved xml files

isReverseConfigLocationResourceArray

public boolean isReverseConfigLocationResourceArray()
Returns:
Returns the reverseConfigLocationResourceArray.

setReverseConfigLocationResourceArray

public void setReverseConfigLocationResourceArray(boolean reverseConfigLocationResourceArray)
Flag to indicate if the resource array of a config location should be reversed. The default is set to false.

Parameters:
reverseConfigLocationResourceArray - Is the reverseConfigLocationResourceArray to set.

invokeBeanFactoryPostProcessorsStrictlyOrdered

public void invokeBeanFactoryPostProcessorsStrictlyOrdered(ConfigurableListableBeanFactory beanFactory)
All bean factory post processors of the given bean factory will be created and invoked in strict order. First the PriorityOrdered, then the Ordered and as last the unordered bean factory post processors.

Parameters:
beanFactory - Is the factory to create the bean factory post processors.

invokeBeanFactoryPostProcessors

protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory,
                                               List<OrderedBeanNameHolder> postProcessorHolders)
Invoke the given BeanFactoryPostProcessor beans.

Parameters:
beanFactory - Is the factory where to create the BeanFactoryPostProcessors
postProcessorHolders - Are the holders of the factory post processor bean names.

getOrderedBeanNameHolder

protected OrderedBeanNameHolder getOrderedBeanNameHolder(ConfigurableListableBeanFactory beanFactory,
                                                         String orderedBeanName)
                                                  throws NoSuchBeanDefinitionException
Returns a ordered bean name holder for the given bean.

Parameters:
beanFactory - Is the factory where the bean is configured.
orderedBeanName - Is the name of the ordered bean.
Returns:
Returns a ordered bean name holder for the given bean.
Throws:
NoSuchBeanDefinitionException - If the given bean name does not exist.


Copyright © 2005-2011 ELCA. All Rights Reserved.