incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1147848 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl: FileDataStore.java PersistentResourceList.java
Date Mon, 18 Jul 2011 13:13:18 GMT
Author: cziegeler
Date: Mon Jul 18 13:13:18 2011
New Revision: 1147848

URL: http://svn.apache.org/viewvc?rev=1147848&view=rev
Log:
SLING-2148 : Untransformed resources are copied on each rendevouz
SLING-2131 : Use modified source path name instead of the fixed string "unknown-resource"
for initial resource copies

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java?rev=1147848&r1=1147847&r2=1147848&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java
Mon Jul 18 13:13:18 2011
@@ -145,7 +145,9 @@ public class FileDataStore {
                 }
             }
         }
-        final String filename = (hint == null ? "unknown" : hint) + "-resource-" + getNextSerialNumber()
+ ".ser";
+        final int pos = url.lastIndexOf('/');
+        final String name = url.substring(pos + 1);
+        final String filename = (hint == null ? "rsrc" : hint) + '-' + name + '-' + getNextSerialNumber()
+ ".ser";
         final File file = this.getDataFile(filename);
 
         this.copyToLocalStorage(stream, file);

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java?rev=1147848&r1=1147847&r2=1147848&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/PersistentResourceList.java
Mon Jul 18 13:13:18 2011
@@ -125,6 +125,15 @@ public class PersistentResourceList {
                 }
             }
         }
+        for(final RegisteredResource rr : this.untransformedResources ) {
+            try {
+                if ( rr.getInputStream() != null ) {
+                    FileDataStore.SHARED.updateDigestCache(rr.getURL(), rr.getDigest());
+                }
+            } catch (final IOException ioe) {
+                // we just ignore this
+            }
+        }
     }
 
     /**
@@ -155,7 +164,14 @@ public class PersistentResourceList {
      * @param input The installable resource
      */
     public RegisteredResource addOrUpdate(final InternalResource input) {
-        // first check if there are resources with the same url and digest
+        // first check untransformed resource if there are resources with the same url and
digest
+        for(final RegisteredResource rr : this.untransformedResources ) {
+            if ( rr.getURL().equals(input.getURL()) && ( rr.getDigest().equals(input.getDigest()))
) {
+                // if we found the resource we can immediately return
+                return rr;
+            }
+        }
+        // installed resources are next
         for(final EntityResourceList group : this.data.values()) {
             for(final RegisteredResource rr : group.getResources()) {
                 if ( rr.getURL().equals(input.getURL()) && ( rr.getDigest().equals(input.getDigest())))
{



Mime
View raw message