[gatein-commits] gatein SVN: r7195 - in portal/trunk: component/common/src/main/java/org/exoplatform/commons/cache and 17 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Aug 22 11:09:43 EDT 2011


Author: julien_viet
Date: 2011-08-22 11:09:43 -0400 (Mon, 22 Aug 2011)
New Revision: 7195

Added:
   portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheManager.java
   portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheProvider.java
   portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCacheManager.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPSessionManager.java
Removed:
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
Modified:
   portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestConcurrencyDataStorage.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMOP.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
   portal/trunk/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration.xml
   portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
   portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
   portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
   portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java
Log:
GTNPORTAL-2037 : Provide a cache manager for simplifying the various cache usage


Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -33,7 +33,7 @@
 import org.exoplatform.container.component.RequestLifeCycle;
 import org.exoplatform.portal.config.UserACL;
 import org.exoplatform.portal.config.model.ApplicationType;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.spi.portlet.Portlet;
 import org.exoplatform.portal.pom.spi.wsrp.WSRP;
 import org.gatein.common.i18n.LocalizedString;
@@ -83,13 +83,13 @@
    private final Logger log = LoggerFactory.getLogger(ApplicationRegistryServiceImpl.class);
 
    /** . */
-   final POMSessionManager mopManager;
+   final MOPSessionManager mopManager;
 
    /** Should match WSRPPortletInfo.PRODUCER_NAME_META_INFO_KEY */
    private static final String PRODUCER_NAME_META_INFO_KEY = "producer-name";
    public static final String PRODUCER_CATEGORY_NAME_SUFFIX = " Producer";
 
-   public ApplicationRegistryServiceImpl(ChromatticManager manager, POMSessionManager mopManager)
+   public ApplicationRegistryServiceImpl(ChromatticManager manager, MOPSessionManager mopManager)
    {
       ApplicationRegistryChromatticLifeCycle lifeCycle = (ApplicationRegistryChromatticLifeCycle)manager.getLifeCycle("app");
       lifeCycle.registry = this;

Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheManager.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheManager.java	                        (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheManager.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.commons.cache;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.jcr.RepositoryService;
+
+/**
+ * Manages the life cycle of {@link CacheProvider} with the current thread. The class implements the
+ * {@link ComponentRequestLifecycle} interface to associate the thread with a provider.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ */
+public class CacheManager implements ComponentRequestLifecycle
+{
+
+   /** . */
+   final RepositoryService repositoryService;
+
+   /** . */
+   final CacheService cacheService;
+
+   /** . */
+   final ThreadLocal<CacheProvider> current;
+
+   public CacheManager(RepositoryService repositoryService, CacheService cacheService) throws NullPointerException
+   {
+      if (repositoryService == null)
+      {
+         throw new NullPointerException("No null repository service accepted");
+      }
+      if (cacheService == null)
+      {
+         throw new NullPointerException("No null cache service accepted");
+      }
+
+      //
+      this.repositoryService = repositoryService;
+      this.cacheService = cacheService;
+      this.current = new ThreadLocal<CacheProvider>();
+   }
+
+   /**
+    * Returns the current provider or return null if no such provider exist.
+    *
+    * @return the current provider
+    */
+   public CacheProvider getCurrentProvider()
+   {
+      return current.get();
+   }
+
+   public void startRequest(ExoContainer exoContainer)
+   {
+      begin();
+   }
+
+   public void endRequest(ExoContainer exoContainer)
+   {
+      end();
+   }
+
+   /**
+    * Attempt to begin a request.
+    *
+    * @return true if the request was begun, false if a provider was already associated
+    */
+   public boolean begin()
+   {
+      if (current.get() != null)
+      {
+         return false;
+      }
+      CacheProvider provider = new CacheProvider(this);
+      current.set(provider);
+      return true;
+   }
+
+   /**
+    * Attempt to end a request.
+    *
+    * @return true if the request was stopped, false if no request was previously associated
+    */
+   public boolean end()
+   {
+      if (current.get() == null)
+      {
+         return false;
+      }
+      current.set(null);
+      return true;
+   }
+}

Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheProvider.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheProvider.java	                        (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/CacheProvider.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.commons.cache;
+
+import org.chromattic.api.UndeclaredRepositoryException;
+import org.exoplatform.services.cache.ExoCache;
+
+import javax.jcr.RepositoryException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Provides caches according to types (classes). The provider is scope to the current request and is managed
+ * by a component request life cycle, it is made available through the {@link CacheManager#getCurrentProvider()} method.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ */
+public class CacheProvider
+{
+
+   /** . */
+   private final CacheManager manager;
+
+   /** . */
+   private Map<Class<?>, ExoCache> caches;
+
+   CacheProvider(CacheManager manager)
+   {
+      this.manager = manager;
+      this.caches = new HashMap<Class<?>, ExoCache>();
+   }
+
+   /**
+    * Returns a cache for a specified cache type or null if such cache does not exist.
+    *
+    * @param cacheType the cache type
+    * @return the corresponding cache
+    * @throws NullPointerException if the cache type is null
+    */
+   public ExoCache<?, ?> getCache(Class<?> cacheType) throws NullPointerException
+   {
+      if (cacheType == null)
+      {
+         throw new NullPointerException("No null cache type accepted");
+      }
+
+      //
+      return caches.get(cacheType);
+   }
+
+   /**
+    * Returns a value for a key for a given cache type. When the value does not exist, null is returned.
+    *
+    * @param cacheType the cache type
+    * @param key the key
+    * @param <K> the key generic type
+    * @param <S> the value generic type
+    * @return the value
+    */
+   public <K extends Serializable, S> S get(Class<?> cacheType, K key) throws NullPointerException
+   {
+      if (key == null)
+      {
+         throw new NullPointerException("No null key accepted");
+      }
+
+      //
+      ExoCache<K, S> cache = (ExoCache<K, S>)getCache(cacheType);
+
+      //
+      if (cache != null)
+      {
+         return cache.get(key);
+      }
+
+      //
+      return null;
+   }
+
+   /**
+    * Associates a value and a key for a given cache type. When the provided value is null, the value is instead
+    * removed from the cache.
+    *
+    * @param cacheType the cache type
+    * @param key the key
+    * @param value the value
+    * @param <K> the key generic type
+    * @param <S> the value generic type
+    */
+   public <K extends Serializable, S> void put(Class<?> cacheType, K key, S value) throws NullPointerException
+   {
+      if (key == null)
+      {
+         throw new NullPointerException("No null key accepted");
+      }
+
+      //
+      ExoCache<K, S> cache = (ExoCache<K, S>)getCache(cacheType);
+
+      //
+      if (value == null)
+      {
+         if (cache != null)
+         {
+            cache.remove(key);
+         }
+      }
+      else
+      {
+         if (cache == null)
+         {
+            String ckey = cacheType.getSimpleName() + "." + getRepositoryName();
+            cache = manager.cacheService.getCacheInstance(ckey);
+            caches.put(cacheType, cache);
+         }
+
+         //
+         cache.put(key, value);
+      }
+   }
+
+   /**
+    * Clear a cache for a given type.
+    *
+    * @param cacheType the cache type
+    * @throws NullPointerException when the cache type is null
+    */
+   public void clear(Class<?> cacheType)  throws NullPointerException
+   {
+      ExoCache<?, ?> cache = getCache(cacheType);
+
+      //
+      if (cache != null)
+      {
+         cache.clearCache();
+      }
+   }
+
+   private String getRepositoryName()
+   {
+      try
+      {
+         return manager.repositoryService.getCurrentRepository().getConfiguration().getName();
+      }
+      catch (RepositoryException e)
+      {
+         throw new UndeclaredRepositoryException("JCR exceptions are really bad", e);
+      }
+   }
+}

Added: portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCacheManager.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCacheManager.java	                        (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/cache/future/FutureCacheManager.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.commons.cache.future;
+
+import org.exoplatform.commons.cache.CacheManager;
+import org.exoplatform.services.cache.ExoCache;
+
+import java.io.Serializable;
+
+/** @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a> */
+public class FutureCacheManager<K extends Serializable, V, C> extends FutureCache<K, V, C>
+{
+
+   /** . */
+   private final CacheManager manager;
+
+   /** . */
+   private final Class<?> cacheType;
+
+   public FutureCacheManager(Class<?> cacheType, Loader<K, V, C> loader, CacheManager manager)
+   {
+      super(loader);
+      
+      //
+      this.cacheType = cacheType;
+      this.manager = manager;
+   }
+
+   public void clear()
+   {
+      ExoCache<?, ?> cache = manager.getCurrentProvider().getCache(cacheType);
+
+      //
+      if (cache != null)
+      {
+         cache.clearCache();
+      }
+   }
+
+   public void remove(K key)
+   {
+      manager.getCurrentProvider().put(cacheType, key, null);
+   }
+
+   @Override
+   public V get(K key)
+   {
+      return manager.getCurrentProvider().get(cacheType, key);
+   }
+
+   @Override
+   public void put(K key, V entry)
+   {
+      manager.getCurrentProvider().put(cacheType, key, entry);
+   }
+}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -44,7 +44,7 @@
 import org.exoplatform.portal.mop.description.DescriptionService;
 import org.exoplatform.portal.mop.navigation.NavigationService;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.common.logging.Logger;
 import org.gatein.common.logging.LoggerFactory;
 import org.gatein.mop.api.workspace.Workspace;
@@ -106,7 +106,7 @@
    private Logger log = LoggerFactory.getLogger(getClass());
 
    /** . */
-   private final POMSessionManager pomMgr;
+   private final MOPSessionManager pomMgr;
 
    /** . */
    private NavigationService navigationService_;
@@ -115,7 +115,7 @@
    private DescriptionService descriptionService_;
 
    public NewPortalConfigListener(
-      POMSessionManager pomMgr,
+      MOPSessionManager pomMgr,
       DataStorage dataStorage,
       ConfigurationManager cmanager,
       InitParams params,

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/DescriptionServiceImpl.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -19,10 +19,11 @@
 
 package org.exoplatform.portal.mop.description;
 
+import org.exoplatform.commons.cache.CacheManager;
 import org.exoplatform.portal.mop.Described;
 import org.exoplatform.portal.mop.i18n.I18NAdapter;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.mop.api.workspace.WorkspaceObject;
 
 import java.util.Collection;
@@ -37,18 +38,23 @@
 {
 
    /** . */
-   private final POMSessionManager manager;
+   private final MOPSessionManager manager;
 
    /** . */
    private DataCache cache;
 
-   public DescriptionServiceImpl(POMSessionManager manager)
+   public DescriptionServiceImpl(MOPSessionManager manager)
    {
       this(manager, new SimpleDataCache());
    }
 
-   public DescriptionServiceImpl(POMSessionManager manager, DataCache cache)
+   public DescriptionServiceImpl(MOPSessionManager manager, CacheManager cacheManager)
    {
+      this(manager, new ExoDataCache(cacheManager));
+   }
+
+   public DescriptionServiceImpl(MOPSessionManager manager, DataCache cache)
+   {
       this.manager = manager;
       this.cache = cache;
    }

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/description/ExoDataCache.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -19,12 +19,11 @@
 
 package org.exoplatform.portal.mop.description;
 
-import org.exoplatform.commons.cache.future.FutureExoCache;
+import org.exoplatform.commons.cache.CacheManager;
+import org.exoplatform.commons.cache.future.FutureCacheManager;
 import org.exoplatform.commons.cache.future.Loader;
 import org.exoplatform.portal.mop.Described;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.ExoCache;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -33,10 +32,10 @@
 {
 
    /** . */
-   protected ExoCache<CacheKey, CacheValue> cache;
+   protected CacheManager cacheManager;
 
    /** . */
-   protected FutureExoCache<CacheKey, CacheValue, POMSession> values;
+   protected FutureCacheManager<CacheKey, CacheValue, POMSession> values;
 
    /** . */
    private Loader<CacheKey, CacheValue, POMSession> valueLoader = new Loader<CacheKey, CacheValue, POMSession>()
@@ -47,25 +46,16 @@
       }
    };
 
-   public ExoDataCache(CacheService cacheService)
+   public ExoDataCache(CacheManager cacheManager)
    {
-      this.cache = cacheService.getCacheInstance("NavigationService");
-      this.values = new FutureExoCache<CacheKey, CacheValue, POMSession>(valueLoader, cache)
-      {
-         @Override
-         protected void put(CacheKey key, CacheValue entry)
-         {
-            // Do nothing on purpose
-            // as data in inserted with the putValue method
-            // during the getValue method
-         }
-      };
+      this.cacheManager = cacheManager;
+      this.values = new FutureCacheManager<CacheKey, CacheValue, POMSession>(DescriptionService.class, valueLoader, cacheManager);
    }
 
    @Override
    protected void removeState(CacheKey key)
    {
-      cache.remove(key);
+      values.remove(key);
    }
 
    @Override
@@ -78,6 +68,7 @@
    @Override
    protected void putValue(CacheKey key, CacheValue value)
    {
-      cache.put(key, value);
+      // Do nothing on purpose
+      // as data was inserted with the put(CacheKey, CacheValue) method
    }
 }

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/AbstractMopOperationHandler.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -25,7 +25,7 @@
 import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.SiteType;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.management.api.PathAddress;
 import org.gatein.management.api.exceptions.OperationException;
 import org.gatein.management.api.exceptions.ResourceNotFoundException;
@@ -57,7 +57,7 @@
          throw new ResourceNotFoundException("No site type found for " + siteType);
       }
 
-      POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
+      MOPSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(MOPSessionManager.class);
       POMSession session = mgr.getSession();
       if (session == null) throw new OperationException(operationName, "MOP session was null");
 

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/MopImportResource.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -37,7 +37,7 @@
 import org.exoplatform.portal.mop.management.exportimport.SiteLayoutImportTask;
 import org.exoplatform.portal.mop.navigation.NavigationService;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.common.logging.Logger;
 import org.gatein.common.logging.LoggerFactory;
 import org.gatein.management.api.ContentType;
@@ -80,7 +80,7 @@
       InputStream inputStream = attachment.getStream();
       if (inputStream == null) throw new OperationException(operationContext.getOperationName(), "No data stream available for import.");
 
-      POMSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(POMSessionManager.class);
+      MOPSessionManager mgr = operationContext.getRuntimeContext().getRuntimeComponent(MOPSessionManager.class);
       POMSession session = mgr.getSession();
       if (session == null) throw new OperationException(operationName, "MOP session was null");
 

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutExportResource.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -26,9 +26,6 @@
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.management.exportimport.SiteLayoutExportTask;
-import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.data.PortalData;
 import org.gatein.management.api.ContentType;
 import org.gatein.management.api.binding.BindingProvider;
 import org.gatein.management.api.exceptions.OperationException;

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/management/operations/site/SiteLayoutReadConfigAsXml.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -25,10 +25,6 @@
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
-import org.exoplatform.portal.pom.data.PortalData;
-import org.exoplatform.portal.pom.data.PortalKey;
 import org.gatein.management.api.exceptions.OperationException;
 import org.gatein.management.api.exceptions.ResourceNotFoundException;
 import org.gatein.management.api.operation.OperationContext;

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/ExoDataCache.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -19,6 +19,8 @@
 
 package org.exoplatform.portal.mop.navigation;
 
+import org.exoplatform.commons.cache.CacheManager;
+import org.exoplatform.commons.cache.future.FutureCacheManager;
 import org.exoplatform.commons.cache.future.FutureExoCache;
 import org.exoplatform.commons.cache.future.Loader;
 import org.exoplatform.portal.mop.SiteKey;
@@ -38,10 +40,10 @@
 {
 
    /** . */
-   protected ExoCache<Serializable, Serializable> cache;
+   protected CacheManager cacheManager;
 
    /** . */
-   protected FutureExoCache<Serializable, Serializable, POMSession> objects;
+   protected FutureCacheManager<Serializable, Serializable, POMSession> objects;
 
    /** . */
    private Loader<Serializable, Serializable, POMSession> navigationLoader = new Loader<Serializable, Serializable, POMSession>()
@@ -59,10 +61,10 @@
       }
    };
 
-   public ExoDataCache(CacheService cacheService)
+   public ExoDataCache(CacheManager cacheManager)
    {
-      this.cache = cacheService.getCacheInstance("NavigationService");
-      this.objects = new FutureExoCache<Serializable, Serializable, POMSession>(navigationLoader, cache);
+      this.cacheManager = cacheManager;
+      this.objects = new FutureCacheManager<Serializable, Serializable, POMSession>(NavigationService.class, navigationLoader, cacheManager);
    }
 
    @Override
@@ -70,7 +72,7 @@
    {
       for (String key : keys)
       {
-         cache.remove(key);
+         objects.remove(key);
       }
    }
 
@@ -83,7 +85,7 @@
    @Override
    protected void removeNavigation(SiteKey key)
    {
-      cache.remove(key);
+      objects.remove(key);
    }
 
    @Override
@@ -95,6 +97,6 @@
    @Override
    protected void clear()
    {
-      cache.clearCache();
+      objects.clear();
    }
 }

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceImpl.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -23,7 +23,7 @@
 import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.Visible;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.data.MappedAttributes;
 import static org.exoplatform.portal.mop.navigation.Utils.*;
 import static org.exoplatform.portal.pom.config.Utils.split;
@@ -53,7 +53,7 @@
 {
 
    /** . */
-   final POMSessionManager manager;
+   final MOPSessionManager manager;
 
    /** . */
    private final DataCache dataCache;
@@ -61,12 +61,12 @@
    /** . */
    final Logger log = LoggerFactory.getLogger(NavigationServiceImpl.class);
 
-   public NavigationServiceImpl(POMSessionManager manager) throws NullPointerException
+   public NavigationServiceImpl(MOPSessionManager manager) throws NullPointerException
    {
       this(manager, new SimpleDataCache());
    }
 
-   public NavigationServiceImpl(POMSessionManager manager, DataCache dataCache) throws NullPointerException
+   public NavigationServiceImpl(MOPSessionManager manager, DataCache dataCache) throws NullPointerException
    {
       if (manager == null)
       {

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/navigation/NavigationServiceWrapper.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -20,11 +20,11 @@
 package org.exoplatform.portal.mop.navigation;
 
 import org.chromattic.api.UndeclaredRepositoryException;
+import org.exoplatform.commons.cache.CacheManager;
 import org.exoplatform.portal.mop.EventType;
 import org.exoplatform.portal.mop.SiteKey;
 import static org.exoplatform.portal.mop.navigation.Utils.*;
-import org.exoplatform.portal.pom.config.POMSessionManager;
-import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.services.jcr.RepositoryService;
 import org.exoplatform.services.jcr.core.ManageableRepository;
 import org.exoplatform.services.listener.ListenerService;
@@ -54,7 +54,7 @@
    private ListenerService listenerService;
 
    /** . */
-   private final POMSessionManager manager;
+   private final MOPSessionManager manager;
 
    /** . */
    private Session session;
@@ -67,7 +67,7 @@
 
    public NavigationServiceWrapper(
       RepositoryService repositoryService,
-      POMSessionManager manager,
+      MOPSessionManager manager,
       ListenerService listenerService)
    {
       SimpleDataCache cache = new SimpleDataCache();
@@ -82,11 +82,11 @@
 
    public NavigationServiceWrapper(
       RepositoryService repositoryService,
-      POMSessionManager manager,
+      MOPSessionManager manager,
       ListenerService listenerService,
-      CacheService cacheService)
+      CacheManager cacheManager)
    {
-      ExoDataCache cache = new ExoDataCache(cacheService);
+      ExoDataCache cache = new ExoDataCache(cacheManager);
 
       //
       this.repositoryService = repositoryService;

Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.config;
-
-import java.io.Serializable;
-
-/**
- * A global key wrapping a local key including the current repository id.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class GlobalKey implements Serializable
-{
-
-   public static GlobalKey wrap(String repositoryName, Serializable localKey)
-   {
-      return new GlobalKey(repositoryName, localKey);
-   }
-
-   /** . */
-   private final String repositoryId;
-
-   /** . */
-   private final Serializable localKey;
-
-   public GlobalKey(String repositoryId, Serializable localKey)
-   {
-      if (repositoryId == null)
-      {
-         throw new NullPointerException();
-      }
-      if (localKey == null)
-      {
-         throw new NullPointerException();
-      }
-      this.repositoryId = repositoryId;
-      this.localKey = localKey;
-   }
-
-   public String getRepositoryId()
-   {
-      return repositoryId;
-   }
-
-   public Serializable getLocalKey()
-   {
-      return localKey;
-   }
-
-   @Override
-   public int hashCode()
-   {
-      return repositoryId.hashCode() ^ localKey.hashCode();
-   }
-
-   @Override
-   public boolean equals(Object obj)
-   {
-      if (obj == this)
-      {
-         return true;
-      }
-      if (obj instanceof GlobalKey)
-      {
-         GlobalKey that = (GlobalKey)obj;
-         return repositoryId.equals(that.repositoryId) && localKey.equals(that.localKey);
-      }
-      return false;
-   }
-
-   @Override
-   public String toString()
-   {
-      return "GlobalKey[repositoryId=" + repositoryId + ",localKey=" + localKey + "]";
-   }
-}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPChromatticLifeCycle.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -33,7 +33,7 @@
 {
 
    /** . */
-   POMSessionManager manager;
+   MOPSessionManager manager;
 
    public MOPChromatticLifeCycle(InitParams params)
    {

Copied: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPSessionManager.java (from rev 7162, portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java)
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPSessionManager.java	                        (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/MOPSessionManager.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -0,0 +1,254 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.pom.config;
+
+import org.exoplatform.commons.cache.CacheManager;
+import org.exoplatform.commons.cache.CacheProvider;
+import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
+import org.exoplatform.commons.chromattic.ChromatticManager;
+import org.exoplatform.commons.chromattic.SessionContext;
+import org.exoplatform.portal.pom.config.cache.DataCache;
+import org.exoplatform.portal.pom.config.cache.PortalNamesCache;
+import org.exoplatform.portal.pom.data.OwnerKey;
+import org.exoplatform.portal.pom.data.PortalKey;
+import org.exoplatform.services.cache.CachedObjectSelector;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.cache.ObjectCacheInfo;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.gatein.mop.core.api.MOPService;
+import org.picocontainer.Startable;
+
+import java.io.Serializable;
+import java.lang.reflect.UndeclaredThrowableException;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class MOPSessionManager implements Startable
+{
+
+   /** . */
+   private final Logger log = LoggerFactory.getLogger(MOPSessionManager.class);
+
+   /** . */
+   private MOPService pomService;
+
+   /** . */
+   private final CacheManager cacheManager;
+
+   /** . */
+   final ChromatticManager manager;
+
+   /** . */
+   private ChromatticLifeCycle configurator;
+
+   /** . */
+   private final TaskExecutionDecorator executor;
+
+   /** . */
+   private final RepositoryService repositoryService;
+
+   public MOPSessionManager(RepositoryService repositoryService, ChromatticManager manager, CacheManager cacheManager)
+   {
+      //
+      this.repositoryService = repositoryService;
+      this.manager = manager;
+      this.cacheManager = cacheManager;
+      this.pomService = null;
+      this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
+   }
+
+   public ChromatticLifeCycle getLifeCycle()
+   {
+      return configurator;
+   }
+
+   public void cachePut(Serializable key, Object value)
+   {
+      CacheProvider provider = cacheManager.getCurrentProvider();
+
+      //
+      if (log.isTraceEnabled())
+      {
+         log.trace("Updating cache key=" + key + " with value=" + value);
+      }
+
+      //
+      provider.put(MOPSessionManager.class, key, value);
+   }
+
+   public Object cacheGet(Serializable key)
+   {
+      CacheProvider provider = cacheManager.getCurrentProvider();
+
+      //
+      Object value = provider.get(MOPSessionManager.class, key);
+
+      //
+      if (log.isTraceEnabled())
+      {
+         log.trace("Obtained for cache key=" + key + " value=" + value);
+      }
+
+      //
+      return value;
+   }
+
+   public void cacheRemove(Serializable key)
+   {
+      if (log.isTraceEnabled())
+      {
+         log.trace("Removing cache key=" + key);
+      }
+
+      //
+      if (key instanceof PortalKey)
+      {
+         final ExoCache cache = cacheManager.getCurrentProvider().getCache(MOPSessionManager.class);
+
+         //
+         if (cache != null)
+         {
+         // This code seems complex but actually it tries to find all objects in cache that have the same
+         // owner key than the portal key, for instance if we remove (portal,classic) then all pages
+         // related to (portal,classic) are also evicted
+         final PortalKey portalKey = (PortalKey)key;
+         try
+         {
+            cache.select(new CachedObjectSelector<Serializable, Object>()
+            {
+               public boolean select(Serializable key, ObjectCacheInfo<?> ocinfo)
+               {
+                  if (key instanceof OwnerKey)
+                  {
+                     OwnerKey selectedOwnerKey = (OwnerKey)key;
+                     if (selectedOwnerKey.getType().equals(portalKey.getType()) && selectedOwnerKey.getId().equals(portalKey.getId()))
+                     {
+                        return true;
+                     }
+                  }
+                  return false;
+               }
+               public void onSelect(ExoCache<? extends Serializable, ?> exoCache, Serializable key, ObjectCacheInfo<?> ocinfo) throws Exception
+               {
+                  cache.remove(key);
+               }
+            });
+         }
+         catch (Exception e)
+         {
+            log.error("Unexpected error when clearing pom cache", e);
+         }
+         }
+      }
+      else
+      {
+         cacheManager.getCurrentProvider().put(MOPSessionManager.class, key, null);
+      }
+   }
+
+   public void start()
+   {
+      try
+      {
+         MOPChromatticLifeCycle configurator = (MOPChromatticLifeCycle)manager.getLifeCycle("mop");
+         configurator.manager = this;
+
+         //
+         PortalMOPService pomService = new PortalMOPService(configurator.getChromattic());
+         pomService.start();
+
+         //
+         this.pomService = pomService;
+         this.configurator = configurator;
+      }
+      catch (Exception e)
+      {
+         throw new UndeclaredThrowableException(e);
+      }
+   }
+
+   public void stop()
+   {
+   }
+
+   public void clearCache()
+   {
+      if (log.isTraceEnabled())
+      {
+         log.trace("Clearing cache");
+      }
+
+      //
+      cacheManager.getCurrentProvider().clear(MOPSessionManager.class);
+   }
+
+   public MOPService getPOMService()
+   {
+      return pomService;
+   }
+
+   public <E extends TaskExecutionDecorator> E getDecorator(Class<E> decoratorClass)
+   {
+      return executor.getDecorator(decoratorClass);
+   }
+
+   /**
+    * <p>Returns the session currently associated with the current thread of execution.</p>
+    *
+    * @return the current session
+    */
+   public POMSession getSession()
+   {
+      SessionContext context = configurator.getContext();
+      return context != null ? (POMSession)context.getAttachment("mopsession") : null;
+   }
+
+   /**
+    * <p>Open and returns a session to the model. When the current thread is already associated with a previously opened
+    * session the method will throw an <tt>IllegalStateException</tt>.</p>
+    *
+    * @return a session to the model.
+    */
+   public POMSession openSession()
+   {
+      SessionContext context = configurator.openContext();
+      return (POMSession)context.getAttachment("mopsession");
+   }
+
+   /**
+    * <p>Execute the task with a session.</p>
+    *
+    * @param task the task to execute
+    * @throws Exception any exception thrown by the task
+    * @return the value
+    */
+   public <V> V execute(POMTask<V> task) throws Exception
+   {
+      POMSession session = getSession();
+
+      //
+      return executor.execute(session, task);
+   }
+
+}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -66,12 +66,12 @@
 {
 
    /** . */
-   private final POMSessionManager pomMgr;
+   private final MOPSessionManager pomMgr;
 
    /** . */
    private ConfigurationManager confManager_;
 
-   public POMDataStorage(POMSessionManager pomMgr, ConfigurationManager confManager)
+   public POMDataStorage(MOPSessionManager pomMgr, ConfigurationManager confManager)
    {
       this.pomMgr = pomMgr;
       this.confManager_ = confManager;

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -72,7 +72,7 @@
    }
 
    /** . */
-   final POMSessionManager mgr;
+   final MOPSessionManager mgr;
 
    /** . */
    private ModelImpl model;
@@ -98,7 +98,7 @@
    /** . */
    private MOPChromatticLifeCycle configurator;
 
-   public POMSession(POMSessionManager mgr, MOPChromatticLifeCycle configurator, SessionContext context)
+   public POMSession(MOPSessionManager mgr, MOPChromatticLifeCycle configurator, SessionContext context)
    {
       // Register for cache eviction
       context.addSynchronizationListener(listener);
@@ -242,7 +242,7 @@
       return prefs;
    }
 
-   public POMSessionManager getManager()
+   public MOPSessionManager getManager()
    {
       return mgr;
    }

Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -1,254 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.pom.config;
-
-import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
-import org.exoplatform.commons.chromattic.ChromatticManager;
-import org.exoplatform.commons.chromattic.SessionContext;
-import org.exoplatform.portal.pom.config.cache.DataCache;
-import org.exoplatform.portal.pom.config.cache.PortalNamesCache;
-import org.exoplatform.portal.pom.data.OwnerKey;
-import org.exoplatform.portal.pom.data.PortalKey;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.cache.CachedObjectSelector;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.cache.ObjectCacheInfo;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
-import org.gatein.mop.core.api.MOPService;
-import org.picocontainer.Startable;
-
-import java.io.Serializable;
-import java.lang.reflect.UndeclaredThrowableException;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class POMSessionManager implements Startable
-{
-
-   /** . */
-   private final Logger log = LoggerFactory.getLogger(POMSessionManager.class);
-
-   /** . */
-   private MOPService pomService;
-
-   /** . */
-   private final ExoCache<GlobalKey, Object> cache;
-
-   /** . */
-   final ChromatticManager manager;
-
-   /** . */
-   private ChromatticLifeCycle configurator;
-
-   /** . */
-   private final TaskExecutionDecorator executor;
-
-   /** . */
-   private final RepositoryService repositoryService;
-
-   public POMSessionManager(RepositoryService repositoryService, ChromatticManager manager, CacheService cacheService)
-   {
-      //
-      this.repositoryService = repositoryService;
-      this.manager = manager;
-      this.cache = cacheService.getCacheInstance("MOPSessionManager");
-      this.pomService = null;
-      this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
-   }
-
-   public ChromatticLifeCycle getLifeCycle()
-   {
-      return configurator;
-   }
-
-   public void cachePut(Serializable key, Object value)
-   {
-      GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
-
-      //
-      if (log.isTraceEnabled())
-      {
-         log.trace("Updating cache key=" + globalKey + " with value=" + value);
-      }
-
-      //
-      cache.put(globalKey, value);
-   }
-
-   public Object cacheGet(Serializable key)
-   {
-      GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
-
-      //
-      Object value = cache.get(globalKey);
-
-      //
-      if (log.isTraceEnabled())
-      {
-         log.trace("Obtained for cache key=" + globalKey + " value=" + value);
-      }
-
-      //
-      return value;
-   }
-
-   public void cacheRemove(Serializable key)
-   {
-      final GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
-
-      //
-      if (log.isTraceEnabled())
-      {
-         log.trace("Removing cache key=" + globalKey);
-      }
-
-      //
-      if (key instanceof PortalKey)
-      {
-         // This code seems complex but actually it tries to find all objects in cache that have the same
-         // owner key than the portal key, for instance if we remove (portal,classic) then all pages
-         // related to (portal,classic) are also evicted
-         final PortalKey portalKey = (PortalKey)key;
-         try
-         {
-            cache.select(new CachedObjectSelector<GlobalKey, Object>()
-            {
-               public boolean select(GlobalKey selectedGlobalKey, ObjectCacheInfo<?> ocinfo)
-               {
-                  if (globalKey.getRepositoryId().equals(selectedGlobalKey.getRepositoryId()))
-                  {
-                     Serializable selectedLocalKey = selectedGlobalKey.getLocalKey();
-                     if (selectedLocalKey instanceof OwnerKey)
-                     {
-                        OwnerKey selectedOwnerKey = (OwnerKey)selectedLocalKey;
-                        if (selectedOwnerKey.getType().equals(portalKey.getType()) && selectedOwnerKey.getId().equals(portalKey.getId()))
-                        {
-                           return true;
-                        }
-                     }
-                  }
-                  return false;
-               }
-               public void onSelect(ExoCache<? extends GlobalKey, ?> exoCache, GlobalKey key, ObjectCacheInfo<?> ocinfo) throws Exception
-               {
-                  cache.remove(key);
-               }
-            });
-         }
-         catch (Exception e)
-         {
-            log.error("Unexpected error when clearing pom cache", e);
-         }
-      }
-      else
-      {
-         cache.remove(globalKey);
-      }
-   }
-
-   public void start()
-   {
-      try
-      {
-         MOPChromatticLifeCycle configurator = (MOPChromatticLifeCycle)manager.getLifeCycle("mop");
-         configurator.manager = this;
-
-         //
-         PortalMOPService pomService = new PortalMOPService(configurator.getChromattic());
-         pomService.start();
-
-         //
-         this.pomService = pomService;
-         this.configurator = configurator;
-      }
-      catch (Exception e)
-      {
-         throw new UndeclaredThrowableException(e);
-      }
-   }
-
-   public void stop()
-   {
-   }
-
-   public void clearCache()
-   {
-      if (log.isTraceEnabled())
-      {
-         log.trace("Clearing cache");
-      }
-
-      //
-      cache.clearCache();
-   }
-
-   public MOPService getPOMService()
-   {
-      return pomService;
-   }
-
-   public <E extends TaskExecutionDecorator> E getDecorator(Class<E> decoratorClass)
-   {
-      return executor.getDecorator(decoratorClass);
-   }
-
-   /**
-    * <p>Returns the session currently associated with the current thread of execution.</p>
-    *
-    * @return the current session
-    */
-   public POMSession getSession()
-   {
-      SessionContext context = configurator.getContext();
-      return context != null ? (POMSession)context.getAttachment("mopsession") : null;
-   }
-
-   /**
-    * <p>Open and returns a session to the model. When the current thread is already associated with a previously opened
-    * session the method will throw an <tt>IllegalStateException</tt>.</p>
-    *
-    * @return a session to the model.
-    */
-   public POMSession openSession()
-   {
-      SessionContext context = configurator.openContext();
-      return (POMSession)context.getAttachment("mopsession");
-   }
-
-   /**
-    * <p>Execute the task with a session.</p>
-    *
-    * @param task the task to execute
-    * @throws Exception any exception thrown by the task
-    * @return the value
-    */
-   public <V> V execute(POMTask<V> task) throws Exception
-   {
-      POMSession session = getSession();
-
-      //
-      return executor.execute(session, task);
-   }
-
-}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/MOPAccess.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -23,7 +23,7 @@
 import org.exoplatform.commons.utils.ListAccess;
 import org.exoplatform.portal.config.Query;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.config.POMTask;
 import org.exoplatform.portal.pom.data.Mapper;
 import org.exoplatform.portal.pom.data.PageData;
@@ -39,7 +39,7 @@
 {
 
    /** . */
-   private final POMSessionManager mgr;
+   private final MOPSessionManager mgr;
 
    /** . */
    private final ObjectType<Site> ownerType;
@@ -53,7 +53,7 @@
    /** . */
    private Integer size;
 
-   MOPAccess(POMSessionManager mgr, Query<E> query)
+   MOPAccess(MOPSessionManager mgr, Query<E> query)
    {
       String ownerType = query.getOwnerType();
       ObjectType<Site> siteType = null;
@@ -131,7 +131,7 @@
    public static class PageAccess extends MOPAccess<PageData, Page>
    {
 
-      public PageAccess(POMSessionManager mgr, Query<PageData> pageDataQuery)
+      public PageAccess(MOPSessionManager mgr, Query<PageData> pageDataQuery)
       {
          super(mgr, pageDataQuery);
       }

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/AbstractImportTest.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -33,7 +33,7 @@
 import org.exoplatform.portal.mop.navigation.NodeContext;
 import org.exoplatform.portal.mop.navigation.NodeModel;
 import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.mop.api.workspace.Workspace;
 
 /**
@@ -153,7 +153,7 @@
       bootstrap.boot();
       container = bootstrap.getContainer();
       service = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
-      POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      MOPSessionManager mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       RequestLifeCycle.begin(container);
       nav = service.loadNavigation(SiteKey.portal("classic"));
       root = service.loadNode(NodeModel.SELF_MODEL, nav, Scope.ALL, null);

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -22,7 +22,7 @@
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
@@ -36,7 +36,7 @@
    DataStorage storage_;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private POMSession session;
@@ -46,7 +46,7 @@
       super.setUp();
       PortalContainer container = getContainer();
       storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
    }
 
    public void testGetNullInvalidation() throws Exception
@@ -144,7 +144,9 @@
       end(true);
 
       // Clear cache
+      begin();
       mgr.clearCache();
+      end();
 
       // The first transaction
       begin();

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestConcurrencyDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestConcurrencyDataStorage.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestConcurrencyDataStorage.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -23,7 +23,7 @@
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 
 /**
  * @author <a href="mailto:hoang281283 at gmail.com">Minh Hoang TO</a>
@@ -35,7 +35,7 @@
 
    private DataStorage storage_;
 
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    public TestConcurrencyDataStorage(String name)
    {
@@ -48,7 +48,7 @@
       begin();
       PortalContainer container = PortalContainer.getInstance();
       storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       
    }
    
@@ -88,7 +88,7 @@
    {
       private DataStorage dataStorage;
       
-      private POMSessionManager sessionManager;
+      private MOPSessionManager sessionManager;
       
       private String pageName;
       
@@ -98,7 +98,7 @@
 
       private final CountDownLatch stopSignal;
       
-      public CreatePageTask(POMSessionManager _sessionManager, DataStorage _dataStorage, CountDownLatch _startSignal, CountDownLatch stopSignal, String _pageName, String _pageTitle)
+      public CreatePageTask(MOPSessionManager _sessionManager, DataStorage _dataStorage, CountDownLatch _startSignal, CountDownLatch stopSignal, String _pageName, String _pageTitle)
       {
          dataStorage = _dataStorage;
          pageName = _pageName;

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestContentRegistry.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -20,7 +20,7 @@
 
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -33,7 +33,7 @@
    private DataStorage storage;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private POMSession session;
@@ -44,7 +44,7 @@
       begin();
       PortalContainer container = PortalContainer.getInstance();
       storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       session = mgr.openSession();
    }
 

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -43,7 +43,7 @@
 import org.exoplatform.portal.mop.navigation.NodeContext;
 import org.exoplatform.portal.mop.navigation.NodeModel;
 import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.data.ModelChange;
 import org.exoplatform.portal.pom.spi.gadget.Gadget;
 import org.exoplatform.portal.pom.spi.portlet.Portlet;
@@ -87,7 +87,7 @@
    private NavigationService navService;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private LinkedList<Event> events;
@@ -118,7 +118,7 @@
       super.setUp();
       PortalContainer container = PortalContainer.getInstance();
       storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
       events = new LinkedList<Event>();
       listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestImport.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -25,7 +25,7 @@
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.container.component.RequestLifeCycle;
 import org.exoplatform.portal.mop.importer.Imported;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.mop.api.workspace.Workspace;
 
 /**
@@ -50,7 +50,7 @@
       //
       bootstrap.boot();
       PortalContainer container = bootstrap.getContainer();
-      POMSessionManager mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      MOPSessionManager mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
 
       //
       RequestLifeCycle.begin(container);

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -25,8 +25,6 @@
 import org.exoplatform.portal.config.model.Container;
 import org.exoplatform.portal.config.model.ModelObject;
 import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.Visibility;
@@ -36,13 +34,11 @@
 import org.exoplatform.portal.mop.navigation.NodeModel;
 import org.exoplatform.portal.mop.navigation.Scope;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 
 import java.util.Arrays;
 import java.util.GregorianCalendar;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 import java.util.TimeZone;
 
 /**
@@ -59,7 +55,7 @@
    private DataStorage storage;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private POMSession session;
@@ -79,7 +75,7 @@
       PortalContainer container = getContainer();
       portalConfigService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
       storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
       session = mgr.openSession();
    }

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMOP.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMOP.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestMOP.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -37,7 +37,7 @@
 import org.exoplatform.portal.mop.navigation.NodeModel;
 import org.exoplatform.portal.mop.navigation.Scope;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.mop.api.Attributes;
 import org.gatein.mop.api.content.Customization;
 import org.gatein.mop.api.workspace.Navigation;
@@ -70,7 +70,7 @@
    private DataStorage storage;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private POMSession session;
@@ -90,7 +90,7 @@
       PortalContainer container = getContainer();
       portalConfigService = (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
       storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
       session = mgr.openSession();
    }

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSearch.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -22,7 +22,7 @@
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 
 import java.util.List;
 
@@ -37,7 +37,7 @@
    private DataStorage storage;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private POMSession session;
@@ -48,7 +48,7 @@
       begin();
       PortalContainer container = PortalContainer.getInstance();
       storage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       session = mgr.openSession();
    }
 

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestUserPortalConfigService.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -29,16 +29,13 @@
 import org.exoplatform.portal.config.model.Container;
 import org.exoplatform.portal.config.model.Page;
 import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
 import org.exoplatform.portal.config.model.PortalConfig;
 import org.exoplatform.portal.mop.EventType;
-import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.user.UserNavigation;
 import org.exoplatform.portal.mop.user.UserPortal;
 import org.exoplatform.portal.pom.config.POMDataStorage;
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.config.cache.DataCache;
 import org.exoplatform.portal.pom.spi.portlet.Portlet;
 import org.exoplatform.portal.pom.spi.portlet.PortletBuilder;
@@ -54,7 +51,6 @@
 import org.exoplatform.services.security.ConversationState;
 import org.gatein.common.util.Tools;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -80,7 +76,7 @@
    private DataStorage storage_;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private Authenticator authenticator;
@@ -121,7 +117,7 @@
       userPortalConfigSer_ =
          (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
       orgService_ = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
       listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
       events = new LinkedList<Event>();
@@ -328,7 +324,7 @@
             }
             catch (Exception ex)
             {
-               assertTrue("Exception while querying pages with new portal", false);
+               fail("Exception while querying pages with new portal", ex);
             }
          }
 

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/description/TestDescriptionService.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -27,7 +27,7 @@
 import org.exoplatform.portal.mop.Described;
 import org.exoplatform.portal.mop.i18n.I18Nized;
 import org.exoplatform.portal.mop.navigation.NavigationServiceImpl;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.gatein.common.util.Tools;
 import org.gatein.mop.api.workspace.Navigation;
 import org.gatein.mop.api.workspace.ObjectType;
@@ -51,7 +51,7 @@
 {
 
    /** . */
-   protected POMSessionManager mgr;
+   protected MOPSessionManager mgr;
 
    /** . */
    protected NavigationServiceImpl service;
@@ -63,7 +63,7 @@
 
       //
       PortalContainer container = PortalContainer.getInstance();
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       service = new NavigationServiceImpl(mgr);
 //      dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);
 

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/AbstractTestNavigationService.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -28,7 +28,7 @@
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.mop.description.DescriptionService;
 import org.exoplatform.portal.mop.description.DescriptionServiceImpl;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -43,7 +43,7 @@
 {
 
    /** . */
-   protected POMSessionManager mgr;
+   protected MOPSessionManager mgr;
 
    /** . */
    protected NavigationServiceImpl service;
@@ -61,7 +61,7 @@
 
       //
       PortalContainer container = PortalContainer.getInstance();
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       service = new NavigationServiceImpl(mgr);
       descriptionService = new DescriptionServiceImpl(mgr);
       dataStorage = (DataStorage)container.getComponentInstanceOfType(DataStorage.class);

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/navigation/TestNavigationServiceWrapper.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -22,7 +22,7 @@
 import org.exoplatform.container.PortalContainer;
 import org.exoplatform.portal.mop.EventType;
 import org.exoplatform.portal.mop.SiteKey;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.services.listener.Event;
 import org.exoplatform.services.listener.Listener;
 import org.exoplatform.services.listener.ListenerService;
@@ -44,7 +44,7 @@
    private ListenerService listenerService;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    @Override
    protected void setUp() throws Exception
@@ -57,7 +57,7 @@
       //
       listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
       navigationService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
    }
 
    public void testNotification() throws NavigationServiceException

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/mop/user/TestUserPortal.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -33,9 +33,8 @@
 import org.exoplatform.portal.mop.SiteKey;
 import org.exoplatform.portal.mop.Visibility;
 import org.exoplatform.portal.mop.navigation.Scope;
-import org.exoplatform.portal.mop.user.UserNodeFilterConfig.Builder;
 import org.exoplatform.portal.pom.config.POMDataStorage;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.services.listener.Event;
 import org.exoplatform.services.listener.Listener;
 import org.exoplatform.services.listener.ListenerService;
@@ -79,7 +78,7 @@
    private DataStorage storage_;
 
    /** . */
-   private POMSessionManager mgr;
+   private MOPSessionManager mgr;
 
    /** . */
    private Authenticator authenticator;
@@ -120,7 +119,7 @@
       userPortalConfigSer_ =
          (UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
       orgService_ = (OrganizationService)container.getComponentInstanceOfType(OrganizationService.class);
-      mgr = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+      mgr = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
       authenticator = (Authenticator)container.getComponentInstanceOfType(Authenticator.class);
       listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class);
       events = new LinkedList<Event>();

Modified: portal/trunk/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration.xml
===================================================================
--- portal/trunk/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration.xml	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration.xml	2011-08-22 15:09:43 UTC (rev 7195)
@@ -43,6 +43,11 @@
   </component>
 
   <component>
+    <key>org.exoplatform.commons.cache.CacheManager</key>
+    <type>org.exoplatform.commons.cache.CacheManager</type>
+  </component>
+
+  <component>
      <key>org.exoplatform.services.security.Authenticator</key>
      <type>org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl</type>
   </component>
@@ -58,8 +63,8 @@
   </component>
 
   <component>
-    <key>org.exoplatform.portal.pom.config.POMSessionManager</key>
-    <type>org.exoplatform.portal.pom.config.POMSessionManager</type>
+    <key>org.exoplatform.portal.pom.config.MOPSessionManager</key>
+    <type>org.exoplatform.portal.pom.config.MOPSessionManager</type>
   </component>
 
   <component>

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml	2011-08-22 15:09:43 UTC (rev 7195)
@@ -122,6 +122,11 @@
   </component>  
 
   <component>
+    <key>org.exoplatform.commons.cache.CacheManager</key>
+    <type>org.exoplatform.commons.cache.CacheManager</type>
+  </component>
+
+  <component>
     <key>org.exoplatform.services.cache.ExoCacheFactory</key>
     <type>org.exoplatform.services.cache.impl.jboss.ExoCacheFactoryImpl</type>
     <init-params>

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml	2011-08-22 15:09:43 UTC (rev 7195)
@@ -26,8 +26,8 @@
    xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
 				  
   <component>
-    <key>org.exoplatform.portal.pom.config.POMSessionManager</key>
-    <type>org.exoplatform.portal.pom.config.POMSessionManager</type>
+    <key>org.exoplatform.portal.pom.config.MOPSessionManager</key>
+    <type>org.exoplatform.portal.pom.config.MOPSessionManager</type>
   </component>
 
   <component>
@@ -330,7 +330,7 @@
           <description>The JBoss Cache configuration for the MOP session Manager</description>
           <object type="org.exoplatform.services.cache.ExoCacheConfig">
             <field name="name">
-              <string>MOPSessionManager</string>
+              <string>MOPSessionManager.repository</string>
             </field>
             <field name="maxSize">
               <int>5000</int>
@@ -353,7 +353,7 @@
           <description>The JBoss Cache configuration for the MOP session Manager</description>
           <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
             <field name="name">
-              <string>MOPSessionManager</string>
+              <string>MOPSessionManager.repository</string>
             </field>
             <field name="expirationTimeout">
               <long>600</long>
@@ -378,7 +378,7 @@
           <description>The JBoss Cache configuration for the navigation service</description>
           <object type="org.exoplatform.services.cache.ExoCacheConfig">
             <field name="name">
-              <string>NavigationService</string>
+              <string>NavigationService.repository</string>
             </field>
             <field name="maxSize">
               <int>5000</int>
@@ -401,7 +401,7 @@
           <description>The JBoss Cache configuration for the navigation service</description>
           <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
             <field name="name">
-              <string>NavigationService</string>
+              <string>NavigationService.repository</string>
             </field>
             <field name="expirationTimeout">
               <long>600000</long>
@@ -429,7 +429,7 @@
           <description>The JBoss Cache configuration for the dezcription service</description>
           <object type="org.exoplatform.services.cache.ExoCacheConfig">
             <field name="name">
-              <string>DescriptionService</string>
+              <string>DescriptionService.repository</string>
             </field>
             <field name="maxSize">
               <int>5000</int>
@@ -452,7 +452,7 @@
           <description>The JBoss Cache configuration for the description service</description>
           <object type="org.exoplatform.services.cache.impl.jboss.ea.EAExoCacheConfig">
             <field name="name">
-              <string>DescriptionService</string>
+              <string>DescriptionService.repository</string>
             </field>
             <field name="expirationTimeout">
               <long>600000</long>

Modified: portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/WSRPServiceIntegration.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -29,7 +29,7 @@
 import org.exoplatform.container.xml.InitParams;
 import org.exoplatform.portal.config.DataStorage;
 import org.exoplatform.portal.pc.ExoKernelIntegration;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator;
 import org.exoplatform.services.listener.ListenerService;
 import org.gatein.common.logging.Logger;
@@ -306,7 +306,7 @@
          consumerRegistry.setSessionEventBroadcaster(sessionEventBroadcaster);
 
          // create ConsumerStructureProvider and register it to listen to page events
-         POMSessionManager sessionManager = (POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
+         MOPSessionManager sessionManager = (MOPSessionManager)container.getComponentInstanceOfType(MOPSessionManager.class);
          PortalStructureAccess structureAccess = new MOPPortalStructureAccess(sessionManager);
          MOPConsumerStructureProvider structureprovider = new MOPConsumerStructureProvider(structureAccess);
          listenerService.addListener(DataStorage.PAGE_CREATED, structureprovider);

Modified: portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java
===================================================================
--- portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java	2011-08-22 10:54:48 UTC (rev 7194)
+++ portal/trunk/wsrp-integration/extension-component/src/main/java/org/gatein/integration/wsrp/structure/MOPPortalStructureAccess.java	2011-08-22 15:09:43 UTC (rev 7195)
@@ -24,7 +24,7 @@
 package org.gatein.integration.wsrp.structure;
 
 import org.exoplatform.portal.pom.config.POMSession;
-import org.exoplatform.portal.pom.config.POMSessionManager;
+import org.exoplatform.portal.pom.config.MOPSessionManager;
 import org.exoplatform.portal.pom.data.Mapper;
 import org.exoplatform.portal.pom.data.PageKey;
 import org.gatein.mop.api.workspace.ObjectType;
@@ -44,9 +44,9 @@
 public class MOPPortalStructureAccess implements PortalStructureAccess
 {
    private static final String PAGES_CHILD_NAME = "pages";
-   private final POMSessionManager pomManager;
+   private final MOPSessionManager pomManager;
 
-   public MOPPortalStructureAccess(POMSessionManager pomManager)
+   public MOPPortalStructureAccess(MOPSessionManager pomManager)
    {
       this.pomManager = pomManager;
    }



More information about the gatein-commits mailing list