incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r520469 - in /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal: skin/SkinStyleSheetParserUtils.java style/cache/FileSystemStyleCache.java style/xml/parse/StyleSheetDocumentParser.java
Date Tue, 20 Mar 2007 16:43:51 GMT
Author: jwaldman
Date: Tue Mar 20 09:43:50 2007
New Revision: 520469

URL: http://svn.apache.org/viewvc?view=rev&rev=520469
Log:
ADFFACES-422 Shouldn't have to stop/start the server if the skin's css file has changed
SkinStyleSheetParserUtils.java & StyleSheetDocumentParser.java now check for URL-based
files for timestamps to
put in the StyleSheetDocument.
FileSystemStyleCache.java has comment changes only.

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocumentParser.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java?view=diff&rev=520469&r1=520468&r2=520469
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
Tue Mar 20 09:43:50 2007
@@ -25,6 +25,10 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+
+import java.net.URL;
+import java.net.URLConnection;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.HashSet;
@@ -99,6 +103,12 @@
     try
     {
 
+      // Store a resolver relative to the file we're about to parse
+      // Store the inputStreamProvider on the context; 
+      // this will be used to get the document's timestamp later on
+      XMLUtils.setResolver(context, resolver.getResolver(sourceName));
+      XMLUtils.setInputStreamProvider(context, provider);
+      
       // PARSE!
       // create a SkinStyleSheetNode
       // (contains a namespaceMap and a List of SkinSelectorPropertiesNodes
@@ -749,10 +759,24 @@
 
     if (provider != null)
     {
-      // And this only works if we are using a File-based InputStream
+      // And this only works if we are using a File-based or URL-based InputStream
       Object identifier = provider.getIdentifier();
       if (identifier instanceof File)
         timestamp = ((File)identifier).lastModified();
+      else if (identifier instanceof URL)
+      {
+        try
+        {
+          URLConnection connection = ((URL)identifier).openConnection();
+          timestamp = connection.getLastModified();
+        }
+        catch (IOException io)
+        {
+          _LOG.warning("Could not get the stylesheet document's timestamp because we couldn't
" +
+          "open the connection.");
+        }
+
+      }
     }
 
     return timestamp;

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?view=diff&rev=520469&r1=520468&r2=520469
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
Tue Mar 20 09:43:50 2007
@@ -320,8 +320,8 @@
       // here, we know they will always be available to other code.
       _initResolver();
 
-      // If checking for modified files, then check to see if the XSS
-      // doc has been modified.  If so, we dump our in-memory style cache.
+      // If checking for modified files, then check to see if the XSS or CSS
+      // document has been modified.  If so, we dump our in-memory style cache.
       if (checkModified && hasSourceDocumentChanged(context))
       {
         _cache = null;
@@ -592,7 +592,6 @@
     String name = outputFile.getName();
 
     // If the output file already exists, check the last modified time.
-    // This isn't really
     if (outputFile.exists())
     {
       if (checkModified)

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocumentParser.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocumentParser.java?view=diff&rev=520469&r1=520468&r2=520469
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocumentParser.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocumentParser.java
Tue Mar 20 09:43:50 2007
@@ -21,6 +21,9 @@
 import java.io.File;
 import java.io.IOException;
 
+import java.net.URL;
+import java.net.URLConnection;
+
 import java.util.Map;
 import java.util.Hashtable;
 import java.util.Vector;
@@ -502,10 +505,26 @@
 
     if (provider != null)
     {
-      // And this only works if we are using a File-based InputStream
+      // And this only works if we are using a File-based or URL-based InputStream
       Object identifier = provider.getIdentifier();
       if (identifier instanceof File)
+      {
         timestamp = ((File)identifier).lastModified();
+      }
+      else if (identifier instanceof URL)
+      {
+        try
+        {
+          URLConnection connection = ((URL)identifier).openConnection();
+          timestamp = connection.getLastModified();
+        }
+        catch (IOException io)
+        {
+          _LOG.warning("Could not get the stylesheet document's timestamp because we couldn't
" +
+          "open the connection.");
+        }
+
+      }
     }
 
     // Merge in timestamps of imported style sheets



Mime
View raw message