incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r653383 - /incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
Date Mon, 05 May 2008 09:26:38 GMT
Author: cziegeler
Date: Mon May  5 02:26:38 2008
New Revision: 653383

URL: http://svn.apache.org/viewvc?rev=653383&view=rev
Log:
SLING-413: Get sling.id only once; handling start and stop should be sufficient.

Modified:
    incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java

Modified: incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java?rev=653383&r1=653382&r2=653383&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
(original)
+++ incubator/sling/trunk/jcr/contentloader/src/main/java/org/apache/sling/jcr/contentloader/internal/ContentLoaderService.java
Mon May  5 02:26:38 2008
@@ -85,6 +85,11 @@
      */
     private Loader initialContentLoader;
 
+    /**
+     * The id of the current instance
+     */
+    private String slingId;
+
     // ---------- BundleListener -----------------------------------------------
 
     /**
@@ -117,17 +122,6 @@
                             + 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 @@
 
     /** 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 @@
         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 @@
                 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) {



Mime
View raw message