incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1075770 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer: api/InstallableResource.java core/impl/InternalResource.java core/impl/OsgiInstallerImpl.java
Date Tue, 01 Mar 2011 10:45:32 GMT
Author: cziegeler
Date: Tue Mar  1 10:45:32 2011
New Revision: 1075770

URL: http://svn.apache.org/viewvc?rev=1075770&view=rev
Log:
SLING-1971 : Persist configuration (and bundle) changes not made through the installer

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java?rev=1075770&r1=1075769&r2=1075770&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
Tue Mar  1 10:45:32 2011
@@ -42,6 +42,10 @@ import java.util.Dictionary;
  * client from having any knowledge about the provided data.
  * However, if the client has the knowledge about the data it can
  * provided a specific resource type.
+ *
+ * The provider should provide a digest for files (input streams).
+ * The installer will calculate a digest for dictionaries, regardless
+ * if the provider provided a dictionary.
  */
 public class InstallableResource {
 
@@ -102,7 +106,7 @@ public class InstallableResource {
      * @param dict A dictionary with data
      * @param digest A digest of the data - providers should make sure to set
      *               a digest. Calculating a digest by the installer can be very
-     *               expensive.
+     *               expensive for input streams
      * @param type The resource type if known, otherwise {@link #TYPE_PROPERTIES}
      *             or {@link #TYPE_FILE}
      * @param priority Optional priority - if not specified {@link #DEFAULT_PRIORITY}

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java?rev=1075770&r1=1075769&r2=1075770&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/InternalResource.java
Tue Mar  1 10:45:32 2011
@@ -77,8 +77,8 @@ public class InternalResource extends In
         if ( is == null ) {
             // if input stream is null, properties is expected!
             type = (type != null ? type : InstallableResource.TYPE_PROPERTIES);
-            digest = (resource.getDigest() != null && resource.getDigest().length()
> 0
-                      ? resource.getDigest() : resource.getId() + ":" + FileDataStore.computeDigest(dict));
+            // we always compute a digest
+            digest = FileDataStore.computeDigest(dict);
         } else {
             final String url = scheme + ':' + resource.getId();
             // if input stream is not null, file is expected!

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1075770&r1=1075769&r2=1075770&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
Tue Mar  1 10:45:32 2011
@@ -676,7 +676,15 @@ public class OsgiInstallerImpl
                 // we first check for update
                 boolean updated = false;
                 if ( erl != null && erl.getFirstResource() != null ) {
+                    // check digest for dictionaries
                     final TaskResource tr = erl.getFirstResource();
+                    if ( dict != null ) {
+                        final String digest = FileDataStore.computeDigest(dict);
+                        if ( tr.getState() == ResourceState.INSTALLED && tr.getDigest().equals(digest)
) {
+                            logger.debug("Resource did not change {}:{}", resourceType, resourceId);
+                            return;
+                        }
+                    }
                     final UpdateHandler handler = this.findHandler(tr.getScheme());
                     if ( handler == null ) {
                         logger.info("No handler found to handle update of resource with scheme
{}", tr.getScheme());



Mime
View raw message