You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:52:47 UTC

[sling-org-apache-sling-launchpad-installer] 06/09: SLING-2171 : Don't copy resources if they are always available (like from the file system)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.launchpad.installer-1.0.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-launchpad-installer.git

commit ab8e945a0050dc16de77db8e2a0093446a538d9b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Aug 9 09:43:31 2011 +0000

    SLING-2171 : Don't copy resources if they are always available (like from the file system)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/launchpad/installer@1155290 13f79535-47bb-0310-9956-ffa450edef68
---
 .../installer/impl/LaunchpadConfigInstaller.java       | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java b/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
index e51300d..22850ab 100644
--- a/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
+++ b/src/main/java/org/apache/sling/launchpad/installer/impl/LaunchpadConfigInstaller.java
@@ -16,7 +16,10 @@
  */
 package org.apache.sling.launchpad.installer.impl;
 
+import java.io.IOException;
 import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Collection;
 import java.util.Dictionary;
 import java.util.HashSet;
@@ -62,13 +65,26 @@ public class LaunchpadConfigInstaller {
                 }
                 if ( !checkPath(resourceProvider, installables, path, resourceType) ) {
                     logger.info("Launchpad {} will be installed: {}", resourceType, path);
+                    final URL url = resourceProvider.getResource(path);
                     Dictionary<String, Object> dict = null;
                     if ( InstallableResource.TYPE_FILE.equals(resourceType) ) {
                         dict = new Hashtable<String, Object>();
                         dict.put(InstallableResource.INSTALLATION_HINT, hint);
+                        try {
+                            dict.put(InstallableResource.RESOURCE_URI_HINT, url.toURI().toString());
+                        } catch (final URISyntaxException e) {
+                            // we just ignore this
+                        }
                     }
+                    long lastModified = -1;
+                    try {
+                        lastModified = url.openConnection().getLastModified();
+                    } catch (final IOException e) {
+                        // we ignore this
+                    }
+                    final String digest = (lastModified > 0 ? String.valueOf(lastModified) : null);
                     final InputStream stream = resourceProvider.getResourceAsStream(path);
-                    installables.add(new InstallableResource(path, stream, dict, null, resourceType, null));
+                    installables.add(new InstallableResource(path, stream, dict, digest, resourceType, null));
                     count++;
                 }
             }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.