incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1076177 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer: api/UpdateResult.java core/impl/OsgiInstallerImpl.java
Date Wed, 02 Mar 2011 11:41:56 GMT
Author: cziegeler
Date: Wed Mar  2 11:41:55 2011
New Revision: 1076177

URL: http://svn.apache.org/viewvc?rev=1076177&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/UpdateResult.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/UpdateResult.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/UpdateResult.java?rev=1076177&r1=1076176&r2=1076177&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/UpdateResult.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/UpdateResult.java
Wed Mar  2 11:41:55 2011
@@ -22,13 +22,29 @@ package org.apache.sling.installer.api;
  * The update result is returned by an {@link UpdateHandler} if
  * a resource could be persisted by the handler.
  *
+ * The update result always contains the complete url where the
+ * resource has been persisted.
+ * If this url is different from the previous location of this
+ * resource, the {@link #getResourceIsMoved()} flag tells the
+ * installer whether the resource has moved to a new location
+ * or if the resource has been additionally added to a new
+ * location (old location contains the old version of
+ * the resource).
+ *
  * @since 3.1
  */
 public class UpdateResult {
 
+    /** The url where the resource has been persisted. */
     private final String url;
+
+    /** A new digest (optional) */
     private String digest;
+
+    /** New priority. */
     private Integer priority;
+
+    /** Is the resource moved or added. */
     private boolean resourceIsMoved = false;
 
     /**
@@ -54,11 +70,18 @@ public class UpdateResult {
         return this.url;
     }
 
+    /**
+     * Return the scheme of the provider.
+     */
     public String getScheme() {
         final int pos = this.url.indexOf(':');
         return this.url.substring(0, pos);
     }
 
+    /**
+     * Return just the resource id (everything in the url
+     * after the colon)
+     */
     public String getResourceId() {
         final int pos = this.url.indexOf(':');
         return this.url.substring(pos + 1);
@@ -82,18 +105,30 @@ public class UpdateResult {
         return this.priority != null ? this.priority : InstallableResource.DEFAULT_PRIORITY;
     }
 
+    /**
+     * Set the priority.
+     */
     public void setPriority(final Integer prio) {
         this.priority = prio;
     }
 
+    /**
+     * Set the digest.
+     */
     public void setDigest(final String digest) {
         this.digest = digest;
     }
 
+    /**
+     * Sett whether this resource has been moved or added.
+     */
     public void setResourceIsMoved(final boolean flag) {
         this.resourceIsMoved = flag;
     }
 
+    /**
+     * Has this resource been moved or added?
+     */
     public boolean getResourceIsMoved() {
         return this.resourceIsMoved;
     }

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=1076177&r1=1076176&r2=1076177&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
Wed Mar  2 11:41:55 2011
@@ -736,8 +736,6 @@ public class OsgiInstallerImpl
                                     erl.compact();
                                 }
                                 updated = true;
-                                this.persistentList.save();
-                                this.wakeUp();
                             }
                         } finally {
                             if ( localIS != null ) {
@@ -780,9 +778,7 @@ public class OsgiInstallerImpl
                                 final EntityResourceList newGroup = this.persistentList.getEntityResourceList(key);
                                 newGroup.setFinishState(ResourceState.INSTALLED);
                                 newGroup.compact();
-                                this.persistentList.save();
                                 created = true;
-                                this.wakeUp();
                                 break;
                             }
                         } finally {
@@ -800,6 +796,10 @@ public class OsgiInstallerImpl
                         logger.debug("No handler found to handle creation of resource {}",
key);
                     }
                 }
+                if ( updated || created ) {
+                    this.persistentList.save();
+                    this.wakeUp();
+                }
 
             }
         } catch (final IOException ioe) {



Mime
View raw message