dev@javaserverfaces.java.net

[REVIEW] Minor performance enhancement to configuration/startup

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Mon, 16 Aug 2004 18:22:22 -0400

Based on suggestion by Craig(?) this change bundle does the following:

Using stylesheets, the jsf-ri-config.xml and standard-html-renderkit.xml
files
are merged into one document (jsf-ri-runtime.xml). Once the merge is
complete,
another stylesheet is applied which removes all tool related metadata.

NOTE: jsf-ri-config.xml and standard-html-renderkit.xml (and its
associated entities)
remain included in the JAR as is.

RI and Demo unit tests pass (TCK in progress though I don't suspect
there will be a problem).


SECTION: Modified Files
----------------------------------
M build.xml
  - added target to apply the xslt stylesheets to the existing
    RI configuration files to create one runtime configuration
    file used by the ConfigureListener

M src/com/sun/faces/config/ConfigureListener.java
  - Modified the parsing sequence to look for the jsf-ri-runtime.xml
    file instead of the jsf-ri-config.xml and standard-html-renderkit.xml
    files

A conf/xslt/jsf-merge-config.xsl
    - merges the jsf-ri-config.xml and standard-html-renderkit.xml

A conf/xslt/jsf-prune-tool-data.xsl
    - removes the tool metadata


SECTION: Diffs
--------------------------------------
Index: build.xml
===================================================================
RCS file: /cvs/javaserverfaces-sources/jsf-ri/build.xml,v
retrieving revision 1.163
diff -u -r1.163 build.xml
--- build.xml 6 Aug 2004 18:25:52 -0000 1.163
+++ build.xml 16 Aug 2004 22:22:51 -0000
@@ -574,7 +574,7 @@
          Create the jars
        ===================================================================
   -->
- <target name="jars" depends="compile">
+ <target name="jars" depends="compile,create.runtime.config">
     <echo message="${build.classes}" />
     <jar jarfile="${build.home}/lib/${name}.jar"
          basedir="${build.classes}" >
@@ -648,6 +648,30 @@
 
 
   <target name="main" depends="jars,copy.to.tck"/>
+
+ <target name="create.runtime.config">
+ <xslt
in="${build.home}/classes/com/sun/faces/standard-html-renderkit.xml"
+ out="merged.xml"
+ style="conf/xslt/jsf-merge-config.xsl">
+ <xmlcatalog id="facesDTDs">
+ <dtd publicId="-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.1//EN"
+
location="${build.home}/classes/com/sun/faces/web-facesconfig_1_1.dtd"/>
+ <dtd publicId="-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.0//EN"
+
location="${build.home}/classes/com/sun/faces/web-facesconfig_1_0.dtd"/>
+ </xmlcatalog>
+ </xslt>
+ <xslt in="merged.xml"
+ out="${build.home}/classes/com/sun/faces/jsf-ri-runtime.xml"
+ style="conf/xslt/jsf-prune-tool-data.xsl">
+ <xmlcatalog id="facesDTDs">
+ <dtd publicId="-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.1//EN"
+
location="${build.home}/classes/com/sun/faces/web-facesconfig_1_1.dtd"/>
+ <dtd publicId="-//Sun Microsystems, Inc.//DTD JavaServer
Faces Config 1.0//EN"
+
location="${build.home}/classes/com/sun/faces/web-facesconfig_1_0.dtd"/>
+ </xmlcatalog>
+ </xslt>
+ <delete file="${basedir}/merged.xml"/>
+ </target>
 
   <!--
        ===================================================================
Index: src/com/sun/faces/config/ConfigureListener.java
===================================================================
RCS file:
/cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/config/ConfigureListener.java,v
retrieving revision 1.24
diff -u -r1.24 ConfigureListener.java
--- src/com/sun/faces/config/ConfigureListener.java 26 Jul 2004
21:12:44 -0000 1.24
+++ src/com/sun/faces/config/ConfigureListener.java 16 Aug 2004
22:22:52 -0000
@@ -90,14 +90,7 @@
      * <p>The path to the RI main configuration file.</p>
      */
     protected static final String JSF_RI_CONFIG =
- "com/sun/faces/jsf-ri-config.xml";
-
-
- /**
- * <p>The path to the RI standard HTML renderkit configuration
file.</p>
- */
- protected static final String JSF_RI_STANDARD =
- "com/sun/faces/standard-html-renderkit.xml";
+ "com/sun/faces/jsf-ri-runtime.xml";
 
     /**
      * <p>The resource path for faces-config files included in the
@@ -280,11 +273,7 @@
         url = Util.getCurrentLoader(this).getResource(JSF_RI_CONFIG);
         parse(digester, url, fcb);
 
- // Step 3, parse the Standard HTML RenderKit
- url = Util.getCurrentLoader(this).getResource(JSF_RI_STANDARD);
- parse(digester, url, fcb);
-
- // Step 4, parse any "/META-INF/faces-config.xml" resources
+ // Step 3, parse any "/META-INF/faces-config.xml" resources
         Iterator resources;
         try {
             List list = new LinkedList();
@@ -312,7 +301,7 @@
             parse(digester, url, fcb);
         }
 
- // Step 5, parse any context-relative resources specified in
+ // Step 4, parse any context-relative resources specified in
         // the web application deployment descriptor
         String paths =
             context.getInitParameter(FacesServlet.CONFIG_FILES_ATTR);
@@ -328,13 +317,13 @@
             }
         }
 
- // Step 6, parse "/WEB-INF/faces-config.xml" if it exists
+ // Step 5, parse "/WEB-INF/faces-config.xml" if it exists
         url = getContextURLForPath(context, WEB_INF_RESOURCE);
         if (url != null) {
             parse(digester, url, fcb);
         }
 
- // Step 7, use the accumulated configuration beans to configure
the RI
+ // Step 6, use the accumulated configuration beans to configure
the RI
         try {
             configure(context, fcb);
         } catch (FacesException e) {
@@ -346,7 +335,7 @@
         }
 
     
- // Step 8, verify that all the configured factories are available
+ // Step 7, verify that all the configured factories are available
         // and optionall that configured objects can be created
         verifyFactories();
         if (isFeatureEnabled(context, VERIFY_OBJECTS)) {



SECTION: New Files
---------------------------------------
 - SEE ATTACHMENTS


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net