View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.spi;
20  
21  import java.util.List;
22  
23  import javax.faces.context.ExternalContext;
24  
25  import org.apache.myfaces.config.element.FacesConfig;
26  
27  /**
28   * This interface provide a way to merge and store all JSF config information retrieved
29   * from faces-config files, META-INF/service files and annotations that works as base
30   * point to initialize MyFaces. The objective is allow server containers to "store" or
31   * this information, preventing calculate it over and over each time the web application
32   * is started.
33   * 
34   * <p>To wrap the default FacesConfigurationProvider, use a constructor like 
35   * CustomFacesConfigurationProvider(FacesConfigurationProvider fcp)
36   * and extend it from FacesConfigurationProviderWrapper</p>
37   * 
38   * @author Leonardo Uribe
39   * @since 2.0.3
40   *
41   */
42  public abstract class FacesConfigurationProvider
43  {
44      /**
45       * Return the FacesConfig object model retrieved from MyFaces META-INF/standard-faces-config.xml file. 
46       * 
47       * @param ectx
48       * @return
49       */
50      public abstract FacesConfig getStandardFacesConfig(ExternalContext ectx);
51      
52      /**
53       * Return the FacesConfig object model retrieved from locate all JSF factories from META-INF/services/[factory_key].
54       * 
55       * The default implementation uses ServiceProviderFinder facilities to locate this SPI interfaces.
56       * 
57       * @param ectx
58       * @return
59       */
60      public abstract FacesConfig getMetaInfServicesFacesConfig(ExternalContext ectx);
61      
62      /**
63       * Return the FacesConfig object model retrieved from scanning annotations on the classpath.
64       * 
65       * @param ectx
66       * @param metadataComplete
67       * @return
68       */
69      public abstract FacesConfig getAnnotationsFacesConfig(ExternalContext ectx, boolean metadataComplete);
70      
71      /**
72       * Return the FacesConfig object model retrieved from resources under the path
73       * META-INF/faces-config.xml and META-INF/[prefix].faces-config.xml
74       * 
75       * @param ectx
76       * @return
77       */
78      public abstract List<FacesConfig> getClassloaderFacesConfig(ExternalContext ectx);
79      
80      /**
81       * Return the FacesConfig object model retrieved from javax.faces.CONFIG_FILES web config attribute
82       * 
83       * @param ectx
84       * @return
85       */
86      public abstract List<FacesConfig> getContextSpecifiedFacesConfig(ExternalContext ectx);
87      
88      /**
89       * Return the FacesConfig object model retrieved from WEB-INF/faces-config.xml
90       * 
91       * @param ectx
92       * @return
93       */
94      public abstract FacesConfig getWebAppFacesConfig(ExternalContext ectx); 
95      
96      /**
97       * Return the FacesConfig object model retrieved from a folder with a faces flow definition
98       * See JSF 2.2 section 11.4.3.3 and section 7.5.1
99       * 
100      * @param ectx
101      * @return 
102      */
103     public abstract List<FacesConfig> getFacesFlowFacesConfig(ExternalContext ectx);
104     
105     /**
106      * Return the FacesConfig object model retrieved from SPI ApplicationConfigurationPopulator
107      */
108     public abstract List<FacesConfig> 
109         getApplicationConfigurationResourceDocumentPopulatorFacesConfig(ExternalContext ectx);
110     
111     /**
112      * Return the FacesConfig object model retrieved from parsing .taglib.xml files according
113      * to spec rules.
114      */    
115     public abstract List<FacesConfig> getFaceletTaglibFacesConfig(ExternalContext ectx);
116 }