[exo-jcr-commits] exo-jcr SVN: r4930 - core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 20 06:25:43 EDT 2011


Author: tolusha
Date: 2011-09-20 06:25:43 -0400 (Tue, 20 Sep 2011)
New Revision: 4930

Modified:
   core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/BaseOrganizationService.java
Log:
JCR-1669: Support ComponentRequestLifecycle

Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/BaseOrganizationService.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/BaseOrganizationService.java	2011-09-16 16:38:25 UTC (rev 4929)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/BaseOrganizationService.java	2011-09-20 10:25:43 UTC (rev 4930)
@@ -18,7 +18,10 @@
  */
 package org.exoplatform.services.organization;
 
+import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.component.ComponentPlugin;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
 import org.picocontainer.Startable;
 
 import java.util.ArrayList;
@@ -28,7 +31,7 @@
  * Created by The eXo Platform SAS Author : Tuan Nguyen
  * tuan08 at users.sourceforge.net Oct 13, 2005
  */
-abstract public class BaseOrganizationService implements OrganizationService, Startable
+abstract public class BaseOrganizationService implements OrganizationService, Startable, ComponentRequestLifecycle
 {
    protected UserHandler userDAO_;
 
@@ -69,21 +72,30 @@
 
    public void start()
    {
-      for (OrganizationServiceInitializer listener : listeners_)
+      try
       {
-         try
+         RequestLifeCycle.begin(this);
+
+         for (OrganizationServiceInitializer listener : listeners_)
          {
-            listener.init(this);
+            try
+            {
+               listener.init(this);
+            }
+            catch (Exception ex)
+            {
+               String msg =
+                  "Failed start Organization Service " + getClass().getName()
+                     + ", probably because of configuration error. Error occurs when initialize "
+                     + listener.getClass().getName();
+               throw new RuntimeException(msg, ex);
+            }
          }
-         catch (Exception ex)
-         {
-            String msg =
-               "Failed start Organization Service " + getClass().getName()
-                  + ", probably because of configuration error. Error occurs when initialize "
-                  + listener.getClass().getName();
-            throw new RuntimeException(msg, ex);
-         }
       }
+      finally
+      {
+         RequestLifeCycle.end();
+      }
    }
 
    public void stop()
@@ -121,4 +133,18 @@
          throw new RuntimeException(listener.getClass().getName() + " is an unknown listener type");
       }
    }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void startRequest(ExoContainer container)
+   {
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   public void endRequest(ExoContainer container)
+   {
+   }
 }



More information about the exo-jcr-commits mailing list