dev@javaserverfaces.java.net

Seeking RETROACTIVE REVIEW Spec work for 313

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Wed, 30 Jan 2008 06:30:31 -0800

Ryan, some questions for you. Search for RYAN.

Thanks,

Ed


Issue: jsf-api 313


SECTION: Modified Files
----------------------------
M jsf-api/src/javax/faces/application/Application.java
M jsf-api/src/javax/faces/application/ProjectStage.java

- Review and freshen docs for getProjectStage(). Some content moved to
  spec prose document.

M jsf-ri/build-tests.xml

- disable

+<!-- <test todir="${impl.test.results.dir}"
+ name="com.sun.faces.application.resource.TestResourceManager"/>-->

  RYAN LUBKE: Please investigate this. The behavior I observe is the
  appserver hangs. I had to kill -9 the app server process.


M jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java
M jsf-ri/src/com/sun/faces/application/ApplicationImpl.java

- Move getProjectStage() impl over to associate.

M jsf-ri/test-sqe/web/WEB-INF/faces-config.xml
M jsf-ri/web/test/WEB-INF/faces-config.xml
M jsf-ri/web/test-config-1/WEB-INF/faces-config.xml

- Move this to JSF 2.0.

  RYAN LUBKE: Please investigate why I had to do this. The 1.2 versions
  of the file were failing XML validation. May be a Mac JDK 1.6 thing.


SECTION: Diffs
----------------------------
Index: jsf-api/src/javax/faces/application/Application.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-api/src/javax/faces/application/Application.java,v
retrieving revision 1.57
diff -u -r1.57 Application.java
--- jsf-api/src/javax/faces/application/Application.java 28 Jan 2008 23:19:55 -0000 1.57
+++ jsf-api/src/javax/faces/application/Application.java 30 Jan 2008 14:23:40 -0000
@@ -392,15 +392,13 @@
 
 
     /**
- * PENDING_REVIEW
- * <p class="changed_added_2_0">Return the product lifecycle phase for the currently running
- * application instance. The default value is {_at_link
- * ProjectStage#Production}</p>
- * <div class="changed_added_2_0">
- * <p>The implementation of this method must perform the following
- * algorithm or an equivalent with the same end result to determine
- * the value to return.</p>
- * <ul>
+ * <p class="changed_added_2_0">Return the project stage
+ * for the currently running application instance. The default
+ * value is {_at_link ProjectStage#Production}</p>
+
+ * <div class="changed_added_2_0"> <p>The implementation of this
+ * method must perform the following algorithm or an equivalent with
+ * the same end result to determine the value to return.</p> <ul>
      *
      * <p>If the value has already been determined by a previous call to
      * this method, simply return that value.</p>
Index: jsf-api/src/javax/faces/application/ProjectStage.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-api/src/javax/faces/application/ProjectStage.java,v
retrieving revision 1.2
diff -u -r1.2 ProjectStage.java
--- jsf-api/src/javax/faces/application/ProjectStage.java 28 Jan 2008 23:19:55 -0000 1.2
+++ jsf-api/src/javax/faces/application/ProjectStage.java 30 Jan 2008 14:23:40 -0000
@@ -38,100 +38,62 @@
 package javax.faces.application;
 
 /**
- * PENDING_REVIEW
- * <p class="changed_added_2_0">This class enables a feature similar to the <code><a target="_"
+
+ * <p class="changed_added_2_0">This class enables a feature similar to
+ * the <code><a target="_"
  * href="http://wiki.rubyonrails.org/rails/pages/Environments">RAILS_ENV</a></code>
  * feature of the Ruby on Rails web framework. The constants in this
  * class represent the current state of the running application in a
  * typical product development lifecycle. The value of this state may
  * be queried at any time after application startup by calling {_at_link
  * Application#getProjectStage}.</p>
- * <div class="changed_added_2_0">
- * <strong>Setting the value to be returned by
- * <code>Application.getProjectStage()</code></strong>
- *
- * <p>This value is immutable at runtime and is configured by a
- * <code>context-param</code>. The value of <code>param-name</code> is
- * the value of the {_at_link #PROJECT_STAGE_PARAM_NAME} constant in this class. The are
- * two kinds of valid values for <code>param-value</code>.</p>
- *
- * <ol>
- *
- * <li><p>The constants: the java language identifiers of the
- * enum members of this class, capitalized exactly as they appear in
- * this file.</p>
- *
- * <p>For example:</p>
- * <pre><code>
- * &lt;context-param&gt;
- * &lt;param-name&gt;javax.faces.application.ProjectStage&lt;/param-name&gt;
- * &lt;param-value&gt;UnitTest&lt;/param-value&gt;
- * &lt;/context-param&gt;
- * </code></pre>
- *
- * <p>In this case,
- * <code>FacesContext.getCurrentInstance().getApplication().getProjectStage()</code>
- * returns <code>ProjectStage.UnitTest</code>, the <code>toString()</code> for which must be <code>"UnitTest"</code></p>
- *
- * </li>
- *
- * <li><p>Every other string: Any string that is not one of the
- * constants is represented as the enum member <code>Extension</code>.
- * The <code>toString()</code> method of <code>Extension</code> must
- * return the string value exactly as given in the
- * <code>param-value</code> element.<p>
- *
- * <p>For example:</p>
- * <pre><code>
- * &lt;context-param&gt;
- * &lt;param-name&gt;javax.faces.application.PROJECT_STATEe&lt;/param-name&gt;
- * &lt;param-value&gt;Some special phase value&lt;/param-value&gt;
- * &lt;/context-param&gt;
- * </code></pre>
- *
- * <p>In this case,
- * <code>FacesContext.getCurrentInstance().getApplication().getProjectStage()</code>
- * returns <code>ProjectStage.Extension</code>, the <code>toString()</code> for which must be <code>"Some special phase value"</code></p>
- *
- * </li>
- * </ol>
- * </div>
- *
+
  * @since 2.0
  */
 public enum ProjectStage {
 
     /**
+ * <p class="changed_added_2_0">
      * This value indicates the currently running application is right
      * now, at this moment, being developed. This value will usually be
- * set during iterative development.
+ * set during iterative development.</p>
      */
     Development,
     /**
+ * <p class="changed_added_2_0">
      * This value indicates the currently running application is
      * undergoing unit testing.
+ * </p>
      */
     UnitTest,
     /**
+ * <p class="changed_added_2_0">
      * This value indicates the currently running application is
      * undergoing system testing.
+ * </p>
      */
     SystemTest,
     /**
+ * <p class="changed_added_2_0">
      * This value indicates the currently running application is
      * deployed in production.
+ * </p>
      */
     Production,
     /**
+ * <p class="changed_added_2_0">
      * This value enables a minimal level of extensibility. See
      * {_at_link #toString} for details.
+ * </p>
      */
     Extension;
 
     /**
+ * <p class="changed_added_2_0">
      * The value of this constant is the value of the
      * <code>param-name</code> for setting the current value to be
- * returned by <code>Application.getProjectStage()</code>.
+ * returned by {_at_link Application#getProjectStage}.
+ * </p>
      */
     public static final String PROJECT_STAGE_PARAM_NAME =
           "javax.faces.PROJECT_STAGE";
@@ -139,10 +101,11 @@
     private String extensionName = "Extension";
 
     /**
- * <p>Specialized to account for an arbitrary product lifecycle
- * phase value. If <code>this == Extension</code> return the value
- * of the <code>extensionName</code> instance variable. Otherwise,
- * return <code>super.toString()</code>.</p>
+ * <p class="changed_added_2_0">Specialized to account for an
+ * arbitrary product lifecycle phase value. If <code>this == *
+ * Extension</code> return the value of the
+ * <code>extensionName</code> * instance variable. Otherwise,
+ * return * <code>super.toString()</code>.</p>
      */
     @Override
     public String toString() {
@@ -153,13 +116,13 @@
     }
 
     /**
- * <p>Take the argument <code>extensionName</code>, and set it as
- * the value of the <code>extensionName</code> instance variable of
- * the <code>Extension</code> enum constant. This enables
- * customizing the value returned from {_at_link #toString}. This
- * method is only called by the runtime, during application startup,
- * in the case where an arbitrary lifecycle phase is being
- * assigned.</p>
+ * <p class="changed_added_2_0">Take the argument
+ * <code>extensionName</code>, and set it as the value of the
+ * <code>extensionName</code> instance variable of the
+ * <code>Extension</code> enum constant. This enables customizing
+ * the value returned from {_at_link #toString}. This method is only
+ * called by the runtime, during application startup, in the case
+ * where an arbitrary lifecycle phase is being assigned.</p>
      */
     public static ProjectStage getExtension(String extensionName) {
         Extension.extensionName = extensionName;
Index: jsf-ri/build-tests.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/build-tests.xml,v
retrieving revision 1.246
diff -u -r1.246 build-tests.xml
--- jsf-ri/build-tests.xml 5 Nov 2007 21:11:47 -0000 1.246
+++ jsf-ri/build-tests.xml 30 Jan 2008 14:23:41 -0000
@@ -273,8 +273,8 @@
             <suite>
                 <test todir="${impl.test.results.dir}"
                     name="com.sun.faces.el.TestResourceELResolver"/>
- <test todir="${impl.test.results.dir}"
- name="com.sun.faces.application.resource.TestResourceManager"/>
+<!-- <test todir="${impl.test.results.dir}"
+ name="com.sun.faces.application.resource.TestResourceManager"/>-->
                 <test todir="${impl.test.results.dir}"
                     name="com.sun.faces.application.resource.TestResourceHandlerImpl"/>
                 <test todir="${impl.test.results.dir}"
Index: jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java,v
retrieving revision 1.51
diff -u -r1.51 ApplicationAssociate.java
--- jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java 9 Jan 2008 14:44:16 -0000 1.51
+++ jsf-ri/src/com/sun/faces/application/ApplicationAssociate.java 30 Jan 2008 14:23:42 -0000
@@ -42,6 +42,7 @@
 
 import com.sun.faces.RIConstants;
 import com.sun.faces.config.WebConfiguration;
+import com.sun.faces.config.WebConfiguration.WebContextInitParameter;
 import com.sun.faces.mgbean.BeanManager;
 import com.sun.faces.spi.InjectionProvider;
 import com.sun.faces.spi.InjectionProviderFactory;
@@ -66,6 +67,7 @@
 import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.TreeSet;
+import javax.faces.application.ProjectStage;
 
 /**
  * <p>Break out the things that are associated with the Application, but
@@ -141,6 +143,8 @@
     private boolean requestServiced;
 
     private BeanManager beanManager;
+
+ private ProjectStage projectStage;
 
     public ApplicationAssociate(ApplicationImpl appImpl) {
         app = appImpl;
@@ -432,6 +436,30 @@
     public TreeSet<String> getNavigationWildCardList() {
         return wildcardMatchList;
     }
+
+ public ProjectStage getProjectStage() {
+
+ if (projectStage == null) {
+ WebConfiguration webConfig =
+ WebConfiguration.getInstance(
+ FacesContext.getCurrentInstance().getExternalContext());
+ String value =
+ webConfig.getOptionValue(WebContextInitParameter.JavaxFacesProjectStage);
+ if (value != null) {
+ try {
+ projectStage = ProjectStage.valueOf(value);
+ } catch (IllegalArgumentException iae) {
+ projectStage = ProjectStage.getExtension(value);
+ }
+ }
+ if (projectStage == null) {
+ projectStage = ProjectStage.Production;
+ }
+ }
+ return projectStage;
+
+ }
+
 
     public ResourceBundle getResourceBundle(FacesContext context,
                                             String var) {
Index: jsf-ri/src/com/sun/faces/application/ApplicationImpl.java
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/application/ApplicationImpl.java,v
retrieving revision 1.98
diff -u -r1.98 ApplicationImpl.java
--- jsf-ri/src/com/sun/faces/application/ApplicationImpl.java 28 Jan 2008 20:55:39 -0000 1.98
+++ jsf-ri/src/com/sun/faces/application/ApplicationImpl.java 30 Jan 2008 14:23:42 -0000
@@ -135,7 +135,6 @@
     // Relationship Instance Variables
 
     private ApplicationAssociate associate = null;
- private ProjectStage projectStage;
 
     private volatile ActionListener actionListener = null;
     private volatile NavigationHandler navigationHandler = null;
@@ -298,24 +297,11 @@
     @Override
     public ProjectStage getProjectStage() {
         
- if (projectStage == null) {
- WebConfiguration webConfig =
- WebConfiguration.getInstance(
- FacesContext.getCurrentInstance().getExternalContext());
- String value =
- webConfig.getOptionValue(WebContextInitParameter.JavaxFacesProjectStage);
- if (value != null) {
- try {
- projectStage = ProjectStage.valueOf(value);
- } catch (IllegalArgumentException iae) {
- projectStage = ProjectStage.getExtension(value);
- }
- }
- if (projectStage == null) {
- projectStage = ProjectStage.Production;
- }
- }
- return projectStage;
+ ProjectStage result = ProjectStage.Production;
+
+ result = getAssociate().getProjectStage();
+
+ return result;
 
     }
 
Index: jsf-ri/test-sqe/web/WEB-INF/faces-config.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/test-sqe/web/WEB-INF/faces-config.xml,v
retrieving revision 1.4
diff -u -r1.4 faces-config.xml
--- jsf-ri/test-sqe/web/WEB-INF/faces-config.xml 27 Apr 2007 22:02:28 -0000 1.4
+++ jsf-ri/test-sqe/web/WEB-INF/faces-config.xml 30 Jan 2008 14:23:45 -0000
@@ -39,8 +39,8 @@
 
 <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
- version="1.2">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
 
 
   <application>
Index: jsf-ri/web/test/WEB-INF/faces-config.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/web/test/WEB-INF/faces-config.xml,v
retrieving revision 1.29
diff -u -r1.29 faces-config.xml
--- jsf-ri/web/test/WEB-INF/faces-config.xml 27 Apr 2007 22:02:37 -0000 1.29
+++ jsf-ri/web/test/WEB-INF/faces-config.xml 30 Jan 2008 14:23:45 -0000
@@ -38,8 +38,8 @@
 
 <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
- version="1.2">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
 
   <!-- Initial application element with partial values -->
   <application>
Index: jsf-ri/web/test-config-1/WEB-INF/faces-config.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/web/test-config-1/WEB-INF/faces-config.xml,v
retrieving revision 1.8
diff -u -r1.8 faces-config.xml
--- jsf-ri/web/test-config-1/WEB-INF/faces-config.xml 27 Apr 2007 22:02:38 -0000 1.8
+++ jsf-ri/web/test-config-1/WEB-INF/faces-config.xml 30 Jan 2008 14:23:45 -0000
@@ -43,8 +43,8 @@
 
 <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
- version="1.2">
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
 
   <component>
     <component-type>DefaultComponent</component-type>
-- 
| ed.burns_at_sun.com  | office: 408 884 9519 OR x31640
| homepage:         | http://purl.oclc.org/NET/edburns/
| aim: edburns0sunw | iim: ed.burns_at_sun.com