org.apache.myfaces.config
Class DefaultFacesConfigurationMerger

java.lang.Object
  extended by org.apache.myfaces.spi.FacesConfigurationMerger
      extended by org.apache.myfaces.config.DefaultFacesConfigurationMerger

public class DefaultFacesConfigurationMerger
extends FacesConfigurationMerger

Default impl of the FacesConfigurationMerger-SPI. This impl gets all FacesConfig data from the current FacesConfigurationProvider SPI impl and merges it into one FacesConfigData object using the ordering and sorting rules of the JSF spec.

Author:
Jakob Korherr

Constructor Summary
DefaultFacesConfigurationMerger()
           
 
Method Summary
protected  List<FacesConfig> applySortingAlgorithm(List<FacesConfig> appConfigResources)
          Sort using topological ordering algorithm.
 FacesConfigData getFacesConfigData(ExternalContext externalContext)
          Returns an object that collect all config information used by MyFaces to initialize the web application.
protected  List<FacesConfig> getPostOrderedList(List<FacesConfig> appConfigResources)
          Pre Sort the appConfigResources, detecting cyclic references, so when sort process start, it is just necessary to traverse the preOrderedList once.
protected  void orderAndFeedArtifacts(FacesConfigDispenser dispenser, List<FacesConfig> appConfigResources, FacesConfig webAppConfig)
           
protected  List<FacesConfig> sortRelativeOrderingList(List<FacesConfig> preOrderedList)
          Sort a list of pre ordered elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFacesConfigurationMerger

public DefaultFacesConfigurationMerger()
Method Detail

getFacesConfigData

public FacesConfigData getFacesConfigData(ExternalContext externalContext)
Description copied from class: FacesConfigurationMerger
Returns an object that collect all config information used by MyFaces to initialize the web application.

Specified by:
getFacesConfigData in class FacesConfigurationMerger
Returns:

orderAndFeedArtifacts

protected void orderAndFeedArtifacts(FacesConfigDispenser dispenser,
                                     List<FacesConfig> appConfigResources,
                                     FacesConfig webAppConfig)
                              throws FacesException
Throws:
FacesException

applySortingAlgorithm

protected List<FacesConfig> applySortingAlgorithm(List<FacesConfig> appConfigResources)
                                           throws FacesException
Sort using topological ordering algorithm.

Parameters:
appConfigResources -
Returns:
Throws:
FacesException

sortRelativeOrderingList

protected List<FacesConfig> sortRelativeOrderingList(List<FacesConfig> preOrderedList)
Sort a list of pre ordered elements. It scans one by one the elements and apply the conditions mentioned by Ordering object if it is available. The preOrderedList ensures that application config resources referenced by other resources are processed first, making more easier the sort procedure.

Parameters:
preOrderedList -
Returns:

getPostOrderedList

protected List<FacesConfig> getPostOrderedList(List<FacesConfig> appConfigResources)
                                        throws FacesException
Pre Sort the appConfigResources, detecting cyclic references, so when sort process start, it is just necessary to traverse the preOrderedList once. To do that, we just scan "before" and "after" lists for references, and then those references are traversed again, so the first elements of the pre ordered list does not have references and the next elements has references to the already added ones. The elements on the preOrderedList looks like this: [ no ordering elements , referenced elements ... more referenced elements, before others / after others non referenced elements]

Parameters:
appConfigResources -
Returns:
Throws:
FacesException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.