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

rombert pushed a commit to annotated tag 
org.apache.sling.jcr.contentloader-2.0.2-incubator
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git

commit 96424e1f4302e01531d435715a60fd82213ed150
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon May 5 09:26:38 2008 +0000

    SLING-413: Get sling.id only once; handling start and stop should be 
sufficient.
    
    git-svn-id: 
https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/contentloader@653383 
13f79535-47bb-0310-9956-ffa450edef68
---
 .../internal/ContentLoaderService.java              | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
 
b/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
index 57874f3..0091df1 100644
--- 
a/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
+++ 
b/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
@@ -85,6 +85,11 @@ public class ContentLoaderService implements 
SynchronousBundleListener {
      */
     private Loader initialContentLoader;
 
+    /**
+     * The id of the current instance
+     */
+    private String slingId;
+
     // ---------- BundleListener 
-----------------------------------------------
 
     /**
@@ -117,17 +122,6 @@ public class ContentLoaderService implements 
SynchronousBundleListener {
                             + event.getBundle().getBundleId() + ")", t);
                 }
                 break;
-            case BundleEvent.UPDATED:
-                try {
-                    Session session = getAdminSession();
-                    initialContentLoader.registerBundle(session, 
event.getBundle(), true);
-                } catch (Throwable t) {
-                    log.error(
-                        "bundleChanged: Problem updating initial content of 
bundle "
-                            + event.getBundle().getSymbolicName() + " ("
-                            + event.getBundle().getBundleId() + ")", t);
-                }
-                break;
             case BundleEvent.STOPPED:
                 try {
                     Session session = getAdminSession();
@@ -181,6 +175,7 @@ public class ContentLoaderService implements 
SynchronousBundleListener {
 
     /** Activates this component, called by SCR before registering as a 
service */
     protected void activate(ComponentContext componentContext) {
+        this.slingId = 
componentContext.getBundleContext().getProperty("sling.id");
         this.initialContentLoader = new Loader(this);
 
         componentContext.getBundleContext().addBundleListener(this);
@@ -300,7 +295,7 @@ public class ContentLoaderService implements 
SynchronousBundleListener {
         if ( contentLoaded ) {
             bcNode.setProperty(ContentLoaderService.PROPERTY_CONTENT_LOADED, 
contentLoaded);
             bcNode.setProperty("content-load-time", Calendar.getInstance());
-            bcNode.setProperty("content-loaded-by", 
bundle.getBundleContext().getProperty("sling.id"));
+            bcNode.setProperty("content-loaded-by", this.slingId);
             bcNode.setProperty("content-unload-time", (String)null);
             bcNode.setProperty("content-unloaded-by", (String)null);
             bcNode.save();
@@ -317,7 +312,7 @@ public class ContentLoaderService implements 
SynchronousBundleListener {
                 final Node bcNode = parentNode.getNode(nodeName);
                 
bcNode.setProperty(ContentLoaderService.PROPERTY_CONTENT_LOADED, false);
                 bcNode.setProperty("content-unload-time", 
Calendar.getInstance());
-                bcNode.setProperty("content-unloaded-by", 
bundle.getBundleContext().getProperty("sling.id"));
+                bcNode.setProperty("content-unloaded-by", this.slingId);
                 bcNode.save();
             }
         } catch (RepositoryException re) {

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to