[exo-jcr-commits] exo-jcr SVN: r4445 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query and 12 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri May 27 14:05:12 EDT 2011


Author: nfilotto
Date: 2011-05-27 14:05:10 -0400 (Fri, 27 May 2011)
New Revision: 4445

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-config.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-lock.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-config.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-lock.xml
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/resources/conf/portal/cache-configuration-template.xml
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/cache-configuration-template.xml
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/distributed-cache-configuration-template.xml
   kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
   kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
   kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
Log:
EXOJCR-1356: Find a way to have a name for MBeans of JBossCaches used by the JCR 

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -16,6 +16,8 @@
  */
 package org.exoplatform.services.jcr.impl.core.lock.jbosscache;
 
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.jmx.annotations.NameTemplate;
@@ -31,8 +33,8 @@
 import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
 import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
 import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
+import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
 import org.exoplatform.services.jcr.jbosscache.PrivilegedJBossCacheHelper;
-import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.exoplatform.services.naming.InitialContextInitializer;
@@ -44,6 +46,7 @@
 import org.jboss.cache.Node;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 import org.jboss.cache.loader.CacheLoader;
 import org.jboss.cache.loader.CacheLoaderManager;
 import org.jboss.cache.lock.TimeoutException;
@@ -116,9 +119,12 @@
 
    private final boolean shareable;
 
+   private final JmxRegistrationManager jmxManager;
+   
    /**
     * Constructor.
     * 
+    * @param ctx The container context
     * @param dataManager - workspace persistent data manager
     * @param config - workspace entry
     * @param context InitialContextInitializer, needed to reload context after JBoss cache creation
@@ -126,31 +132,33 @@
     *          the transaction service
     * @throws RepositoryConfigurationException
     */
-   public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
+   public CacheableLockManagerImpl(ExoContainerContext ctx, WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
       InitialContextInitializer context, TransactionService transactionService, ConfigurationManager cfm,
       LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
    {
-      this(dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
+      this(ctx, dataManager, config, context, transactionService.getTransactionManager(), cfm, lockRemoverHolder);
    }
 
    /**
     * Constructor.
     * 
+    * @param ctx The container context
     * @param dataManager - workspace persistent data manager
     * @param config - workspace entry
     * @param context InitialContextInitializer, needed to reload context after JBoss cache creation
     * @throws RepositoryConfigurationException
     */
-   public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
+   public CacheableLockManagerImpl(ExoContainerContext ctx, WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
       InitialContextInitializer context, ConfigurationManager cfm, LockRemoverHolder lockRemoverHolder)
       throws RepositoryConfigurationException, RepositoryException
    {
-      this(dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
+      this(ctx, dataManager, config, context, (TransactionManager)null, cfm, lockRemoverHolder);
    }
 
    /**
     * Constructor.
     * 
+    * @param ctx The container context
     * @param dataManager - workspace persistent data manager
     * @param config - workspace entry
     * @param context InitialContextInitializer, needed to reload context after JBoss cache creation
@@ -158,7 +166,7 @@
     *          the transaction manager
     * @throws RepositoryConfigurationException
     */
-   public CacheableLockManagerImpl(WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
+   public CacheableLockManagerImpl(ExoContainerContext ctx, WorkspacePersistentDataManager dataManager, WorkspaceEntry config,
       InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm,
       LockRemoverHolder lockRemoverHolder) throws RepositoryConfigurationException, RepositoryException
    {
@@ -184,6 +192,18 @@
             config.getLockManager().getParameterBoolean(JBOSSCACHE_SHAREABLE, JBOSSCACHE_SHAREABLE_DEFAULT)
                .booleanValue();
          cache = ExoJBossCacheFactory.getUniqueInstance(CacheType.LOCK_CACHE, rootFqn, cache, shareable);
+         this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(ctx, cache, CacheType.LOCK_CACHE);
+         if (jmxManager != null)
+         {
+            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+            {
+               public Void run()
+               {
+                  jmxManager.registerAllMBeans();
+                  return null;
+               }
+            });
+         }
          PrivilegedJBossCacheHelper.create(cache);
          if (cache.getCacheStatus().startAllowed())
          {
@@ -490,6 +510,17 @@
       {
          PrivilegedJBossCacheHelper.stop(cache);
       }
+      if (jmxManager != null)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               jmxManager.unregisterAllMBeans();
+               return null;
+            }
+         });
+      }      
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -18,9 +18,9 @@
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.search.BooleanClause.Occur;
 import org.apache.lucene.search.BooleanQuery;
 import org.apache.lucene.search.WildcardQuery;
-import org.apache.lucene.search.BooleanClause.Occur;
 import org.exoplatform.commons.utils.PrivilegedFileHelper;
 import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
@@ -237,6 +237,8 @@
     * Switches index between online and offline modes
     */
    private RemoteCommand changeIndexState;
+   
+   private final ExoContainerContext ctx;
 
    private String hotReindexingState = "not stated";
 
@@ -288,6 +290,7 @@
       final RepositoryIndexSearcherHolder indexSearcherHolder, RPCService rpcService) throws RepositoryException,
       RepositoryConfigurationException
    {
+      this.ctx = ctx;
       this.wsContainerId = ctx.getName();
       this.rpcService = rpcService;
       this.repositoryName = rEntry.getName();
@@ -808,6 +811,14 @@
    }
 
    /**
+    * @return the ctx
+    */
+   public ExoContainerContext getExoContainerContext()
+   {
+      return ctx;
+   }
+
+   /**
     * Initialize changes filter.
     * @throws RepositoryException
     * @throws RepositoryConfigurationException

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -18,6 +18,7 @@
  */
 package org.exoplatform.services.jcr.impl.core.query.jbosscache;
 
+import org.exoplatform.commons.utils.SecurityHelper;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.services.jcr.config.QueryHandlerEntry;
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -40,9 +41,11 @@
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.security.PrivilegedAction;
 import java.util.Properties;
 
 import javax.jcr.RepositoryException;
@@ -75,6 +78,8 @@
    private final Cache<Serializable, Object> cache;
 
    private final Fqn<String> rootFqn;
+   
+   private final JmxRegistrationManager jmxManager;
 
    public static final String LISTWRAPPER = "$lists".intern();
 
@@ -135,6 +140,19 @@
 
       PrivilegedJBossCacheHelper.create(cache);
       PrivilegedJBossCacheHelper.start(cache);
+      
+      this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache, CacheType.INDEX_CACHE);
+      if (jmxManager != null)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               jmxManager.registerAllMBeans();
+               return null;
+            }
+         });
+      }
 
       // start will invoke cache listener which will notify handler that mode is changed
       IndexerIoMode ioMode =
@@ -183,4 +201,30 @@
    {
       return true;
    }
+
+   /**
+    * @see java.lang.Object#finalize()
+    */
+   @Override
+   protected void finalize() throws Throwable
+   {
+      try
+      {
+         if (jmxManager != null)
+         {
+            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+            {
+               public Void run()
+               {
+                  jmxManager.unregisterAllMBeans();
+                  return null;
+               }
+            });
+         }
+      }
+      finally
+      {
+         super.finalize();         
+      }
+   } 
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/LocalIndexChangesFilter.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -18,6 +18,7 @@
  */
 package org.exoplatform.services.jcr.impl.core.query.jbosscache;
 
+import org.exoplatform.commons.utils.SecurityHelper;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.services.jcr.config.QueryHandlerEntry;
 import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -38,9 +39,11 @@
 import org.jboss.cache.Fqn;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.security.PrivilegedAction;
 
 import javax.jcr.RepositoryException;
 
@@ -82,6 +85,8 @@
 
    private final Fqn<String> rootFqn;
 
+   private final JmxRegistrationManager jmxManager;
+   
    public static final String LISTWRAPPER = "$lists".intern();
 
    /**
@@ -126,6 +131,18 @@
 
       PrivilegedJBossCacheHelper.create(cache);
       PrivilegedJBossCacheHelper.start(cache);
+      this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(searchManager.getExoContainerContext(), cache, CacheType.INDEX_CACHE);
+      if (jmxManager != null)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               jmxManager.registerAllMBeans();
+               return null;
+            }
+         });
+      }
 
       indexerCacheLoader = (IndexerCacheLoader)((CacheSPI)cache).getCacheLoaderManager().getCacheLoader();
 
@@ -155,4 +172,30 @@
       String id = IdGenerator.generate();
       PrivilegedJBossCacheHelper.put(cache, Fqn.fromRelativeElements(rootFqn, id), LISTWRAPPER, changes);
    }
+   
+   /**
+    * @see java.lang.Object#finalize()
+    */
+   @Override
+   protected void finalize() throws Throwable
+   {
+      try
+      {
+         if (jmxManager != null)
+         {
+            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+            {
+               public Void run()
+               {
+                  jmxManager.unregisterAllMBeans();
+                  return null;
+               }
+            });
+         }         
+      }
+      finally
+      {
+         super.finalize();         
+      }
+   }    
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -18,6 +18,8 @@
  */
 package org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache;
 
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.annotations.ManagedDescription;
@@ -59,11 +61,13 @@
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.EvictionRegionConfig;
 import org.jboss.cache.eviction.ExpirationAlgorithmConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 import org.picocontainer.Startable;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -409,6 +413,8 @@
     */
    protected volatile boolean initialized;
 
+   private JmxRegistrationManager jmxManager;
+
    /**
     * Node order comparator for getChildNodes().
     */
@@ -532,12 +538,13 @@
    /**
     * Cache constructor with eXo TransactionService support.
     * 
+    * @param ctx The container context
     * @param wsConfig WorkspaceEntry workspace config
     * @param transactionService TransactionService external transaction service
     * @throws RepositoryException if error of initialization
     * @throws RepositoryConfigurationException if error of configuration
     */
-   public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
+   public JBossCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, TransactionService transactionService,
       ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
    {
       if (wsConfig.getCache() == null)
@@ -589,6 +596,10 @@
       parentCache =
          ExoJBossCacheFactory.getUniqueInstance(CacheType.JCR_CACHE, rootFqn, parentCache, wsConfig.getCache()
             .getParameterBoolean(JBOSSCACHE_SHAREABLE, JBOSSCACHE_SHAREABLE_DEFAULT).booleanValue());
+      if (ctx != null)
+      {
+         this.jmxManager = ExoJBossCacheFactory.getJmxRegistrationManager(ctx, parentCache, CacheType.JCR_CACHE);
+      }
 
       // if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
       this.cache =
@@ -613,16 +624,31 @@
    }
 
    /**
+    * Cache constructor with eXo TransactionService support.
+    * 
+    * @param wsConfig WorkspaceEntry workspace config
+    * @param transactionService TransactionService external transaction service
+    * @throws RepositoryException if error of initialization
+    * @throws RepositoryConfigurationException if error of configuration
+    */
+   public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, TransactionService transactionService,
+      ConfigurationManager cfm) throws RepositoryException, RepositoryConfigurationException
+   {
+      this(null, wsConfig, transactionService, cfm);
+   }
+
+   /**
     * Cache constructor with JBossCache JTA transaction support.
     * 
+    * @param ctx The container context
     * @param wsConfig WorkspaceEntry workspace config
     * @throws RepositoryException if error of initialization
     * @throws RepositoryConfigurationException if error of configuration
     */
-   public JBossCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm)
+   public JBossCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm)
       throws RepositoryException, RepositoryConfigurationException
    {
-      this(wsConfig, null, cfm);
+      this(ctx, wsConfig, null, cfm);
    }
 
    /**
@@ -647,6 +673,17 @@
       createResidentNode(childNodesByPatternList);
       createResidentNode(itemsRoot);
 
+      if (jmxManager != null)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               jmxManager.registerAllMBeans();
+               return null;
+            }
+         });
+      }
       this.initialized = true;
    }
 
@@ -665,6 +702,17 @@
     */
    public void stop()
    {
+      if (jmxManager != null)
+      {
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               jmxManager.unregisterAllMBeans();
+               return null;
+            }
+         });
+      }      
    }
 
    /**

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,6 +31,7 @@
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
 import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.jmx.MBeanServerLookup;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.manager.EmbeddedCacheManager;
 
@@ -44,6 +45,8 @@
 import java.util.Map;
 import java.util.Properties;
 
+import javax.management.MBeanServer;
+
 /**
  * Factory that creates and starts pre-configured instances of Infinispan.
  * Path to Infinispan configuration or template and cache name should be 
@@ -71,6 +74,14 @@
    private static Map<GlobalConfiguration, EmbeddedCacheManager> CACHE_MANAGERS =
       new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
 
+   private static final MBeanServerLookup MBEAN_SERVER_LOOKUP = new MBeanServerLookup()
+   {
+      public MBeanServer getMBeanServer(Properties properties)
+      {
+         return ExoContainerContext.getTopContainer().getMBeanServer();
+      }      
+   };
+   
    /**
     * Creates InfinispanCacheFactory with provided configuration transaction managers.
     * Transaction manager will later be injected to cache instance. 
@@ -206,6 +217,9 @@
       ExoContainer container = ExoContainerContext.getCurrentContainer();
       // Ensure that the cluster name won't be used between 2 ExoContainers
       gc.setClusterName(gc.getClusterName() + "_" + container.getContext().getName());
+      gc.setCacheManagerName(gc.getCacheManagerName() + "_" + container.getContext().getName());
+      // Configure the MBeanServerLookup
+      gc.setMBeanServerLookupInstance(MBEAN_SERVER_LOOKUP);
       Configuration conf = manager.getDefaultConfiguration();
       if (CACHE_MANAGERS.containsKey(gc))
       {

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -35,6 +35,7 @@
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
 import org.jgroups.JChannelFactory;
 
 import java.io.IOException;
@@ -44,6 +45,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.management.ObjectName;
 import javax.transaction.TransactionManager;
 
 /**
@@ -316,6 +318,31 @@
    }
 
    /**
+    * Gives the {@link JmxRegistrationManager} instance corresponding to the given context
+    */
+   public static JmxRegistrationManager getJmxRegistrationManager(ExoContainerContext ctx, Cache<?, ?> parentCache,
+      CacheType cacheType)
+   {
+      try
+      {
+         ObjectName containerObjectName = ctx.getContainer().getScopingObjectName();
+         final String objectNameBase = containerObjectName.toString() + ",cache-type=" + cacheType;
+         return new JmxRegistrationManager(ctx.getContainer().getMBeanServer(), parentCache, objectNameBase)
+         {
+            public String getObjectName(String resourceName)
+            {
+               return objectNameBase + JMX_RESOURCE_KEY + resourceName;
+            }
+         };
+      }
+      catch (Exception e)
+      {
+         log.error("Could not create the JMX Manager", e);
+      }
+      return null;
+   }
+   
+   /**
     * All the known cache types
     */
    public enum CacheType {

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-config.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-config.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,7 +31,7 @@
         </properties>
       </evictionScheduledExecutor>
 
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true" allowDuplicateDomains="true"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
 
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="${infinispan-cluster-name}" distributedSyncTimeout="20000">
         <properties>

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-indexer.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,7 +31,7 @@
         </properties>
       </evictionScheduledExecutor>
 
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true" allowDuplicateDomains="true"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
 
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="${infinispan-cluster-name}" distributedSyncTimeout="20000">
         <properties>

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-lock.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-infinispan-lock.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,7 +31,7 @@
         </properties>
       </evictionScheduledExecutor>
 
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true" allowDuplicateDomains="true"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
 
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="${infinispan-cluster-name}" distributedSyncTimeout="20000">
         <properties>

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-config.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-config.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,7 +31,7 @@
         </properties>
       </evictionScheduledExecutor>
 
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true" allowDuplicateDomains="true"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
     </global>
 
     <default>

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-lock.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-infinispan-lock.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,7 +31,7 @@
         </properties>
       </evictionScheduledExecutor>
 
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true" allowDuplicateDomains="true"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
     </global>
 
     <default>

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,9 +31,10 @@
 import org.exoplatform.services.log.Log;
 import org.infinispan.Cache;
 import org.infinispan.config.Configuration;
+import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.config.GlobalConfiguration;
-import org.infinispan.config.Configuration.CacheMode;
 import org.infinispan.eviction.EvictionStrategy;
+import org.infinispan.jmx.MBeanServerLookup;
 import org.infinispan.manager.DefaultCacheManager;
 import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
 
@@ -48,6 +49,8 @@
 import java.util.Set;
 import java.util.concurrent.Callable;
 
+import javax.management.MBeanServer;
+
 /**
  * This class is the Infinispan implementation of the {@link org.exoplatform.services.cache.ExoCacheFactory}
  * 
@@ -111,6 +114,14 @@
     * The default creator
     */
    private final ExoCacheCreator defaultCreator = new GenericExoCacheCreator();
+   
+   private static final MBeanServerLookup MBEAN_SERVER_LOOKUP = new MBeanServerLookup()
+   {
+      public MBeanServer getMBeanServer(Properties properties)
+      {
+         return ExoContainerContext.getTopContainer().getMBeanServer();
+      }      
+   };
 
    public ExoCacheFactoryImpl(ExoContainerContext ctx, InitParams params, ConfigurationManager configManager)
       throws ExoCacheInitException
@@ -170,11 +181,28 @@
 
       GlobalConfiguration config = cacheManager.getGlobalConfiguration();
       
-      configureJGroups(config);
+      configureCacheManager(config);
+      cacheManager.start();
       return cacheManager;
    }
 
    /**
+    * Configure the cache manager
+    * 
+    * @param config
+    * @throws ExoCacheInitException
+    */
+   private void configureCacheManager(GlobalConfiguration config) throws ExoCacheInitException
+   {
+      // Configure JGroups
+      configureJGroups(config);
+      // Configure the name of the cache manager
+      config.setCacheManagerName(config.getCacheManagerName() + "_" + ctx.getName());
+      // Configure the MBeanServerLookup
+      config.setMBeanServerLookupInstance(MBEAN_SERVER_LOOKUP);
+   }
+
+   /**
     * If some JGoups properties has been set, it will load the configuration and set
     * the cluster name by adding as suffix the name of the {@link ExoContainerContext}
     * 
@@ -292,14 +320,17 @@
             // Create the CacheManager by loading the configuration
             DefaultCacheManager customCacheManager = new DefaultCacheManager(configManager.getInputStream(customConfig), false);
             GlobalConfiguration gc = customCacheManager.getGlobalConfiguration();
-            // Configure JGroups since it could affect the state of the Global Config
-            configureJGroups(gc);
+            // Configure JGroups and JMX since it could affect the state of the Global Config
+            configureCacheManager(gc);
             // Check if a CacheManager with the same GlobalConfiguration exists
             DefaultCacheManager currentCacheManager = mappingGlobalConfigCacheManager.get(gc);
             if (currentCacheManager == null)
             {
                // No cache manager has been defined so far for this Cache Configuration
                currentCacheManager = customCacheManager;
+               // Use a different cache manager name to prevent naming conflict
+               gc.setCacheManagerName(gc.getCacheManagerName() + "_" + region + "_" + ctx.getName());
+               currentCacheManager.start();
                // We register this new cache manager
                mappingGlobalConfigCacheManager.put(gc, customCacheManager);
             }

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/resources/conf/portal/cache-configuration-template.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/resources/conf/portal/cache-configuration-template.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/main/resources/conf/portal/cache-configuration-template.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -44,8 +44,8 @@
             <property name="threadNamePrefix" value="ReplicationQueueThread"/>
          </properties>
       </replicationQueueScheduledExecutor>
-      <globalJmxStatistics jmxDomain="infinispan" enabled="true"/>
-      <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="Infinispan-cluster" distributedSyncTimeout="20000">
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
+      <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="eXoCache-cluster" distributedSyncTimeout="20000">
       	<properties>
          <property name="configurationFile" value="flush-udp.xml"/>
       	</properties>

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/cache-configuration-template.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/cache-configuration-template.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/cache-configuration-template.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -44,7 +44,7 @@
             <property name="threadNamePrefix" value="ReplicationQueueThread"/>
          </properties>
       </replicationQueueScheduledExecutor>
-      <globalJmxStatistics jmxDomain="infinispan" enabled="false"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true" />
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="Infinispan-cluster" distributedSyncTimeout="20000">
       	<properties>
          <property name="configurationFile" value="flush-udp.xml"/>
@@ -55,7 +55,7 @@
    <default>
       <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="10000" writeSkewCheck="false" concurrencyLevel="500"/>
       <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" syncRollbackPhase="false" syncCommitPhase="false"/>
-      <jmxStatistics enabled="false"/>
+      <jmxStatistics enabled="true"/>
       <clustering mode="replication">
          <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
          <sync replTimeout="20000"/>

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/distributed-cache-configuration-template.xml
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/distributed-cache-configuration-template.xml	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v4/src/test/resources/conf/portal/distributed-cache-configuration-template.xml	2011-05-27 18:05:10 UTC (rev 4445)
@@ -44,7 +44,7 @@
             <property name="threadNamePrefix" value="ReplicationQueueThread"/>
          </properties>
       </replicationQueueScheduledExecutor>
-      <globalJmxStatistics jmxDomain="infinispan" enabled="false"/>
+      <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
       <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="Infinispan-cluster" distributedSyncTimeout="20000">
       	<properties>
          <property name="configurationFile" value="flush-udp.xml"/>

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -18,6 +18,9 @@
  */
 package org.exoplatform.services.cache.impl.jboss;
 
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
 import org.exoplatform.container.configuration.ConfigurationManager;
 import org.exoplatform.container.xml.InitParams;
 import org.exoplatform.container.xml.ValueParam;
@@ -35,13 +38,19 @@
 import org.jboss.cache.config.Configuration.CacheMode;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
+import org.jboss.cache.jmx.JmxRegistrationManager;
+import org.picocontainer.Startable;
 
 import java.io.Serializable;
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
 
+import javax.management.ObjectName;
+
 /**
  * This class is the JBoss Cache implementation of the {@link org.exoplatform.services.cache.ExoCacheFactory}
  * Created by The eXo Platform SAS
@@ -49,7 +58,7 @@
  *          exo at exoplatform.com
  * 17 juil. 2009  
  */
-public class ExoCacheFactoryImpl implements ExoCacheFactory
+public class ExoCacheFactoryImpl implements ExoCacheFactory, Startable
 {
 
    /**
@@ -108,6 +117,11 @@
       new HashMap<ConfigurationKey, Cache<Serializable, Object>>();
 
    /**
+    * The list of all the JMX Managers registered
+    */
+   private final List<JmxRegistrationManager> jmxManagers = new CopyOnWriteArrayList<JmxRegistrationManager>();
+   
+   /**
     * The default creator
     */
    private final ExoCacheCreator defaultCreator = new FIFOExoCacheCreator();
@@ -172,13 +186,27 @@
          }
          final ExoCacheCreator creator = getExoCacheCreator(config);
          // Ensure that new created cache doesn't exist
-         cache = getUniqueInstance(cache, config);
+         final Cache<Serializable, Object> effectiveCacheInstance = getUniqueInstance(cache, config);
          // Create the cache
-         eXoCache = creator.create(config, cache);
-         // Create the cache
-         PrivilegedCacheHelper.create(cache);
-         // Start the cache
-         PrivilegedCacheHelper.start(cache);
+         eXoCache = creator.create(config, effectiveCacheInstance);
+         SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+         {
+            public Void run()
+            {
+               // Create the cache
+               effectiveCacheInstance.create();
+               // Start the cache
+               effectiveCacheInstance.start();
+               // Create JMX Manager for this cache instance
+               JmxRegistrationManager jmxManager = getJmxRegistrationManager(effectiveCacheInstance, region);
+               if (jmxManager != null)
+               {
+                  jmxManager.registerAllMBeans();
+                  jmxManagers.add(jmxManager);
+               }
+               return null;
+            }
+         });
       }
       catch (Exception e)
       {
@@ -186,8 +214,34 @@
       }
       return eXoCache;
    }
-
+   
    /**
+    * Gives the {@link JmxRegistrationManager} instance corresponding to the given context
+    */
+   private static JmxRegistrationManager getJmxRegistrationManager(Cache<?, ?> parentCache,
+      String cacheName)
+   {
+      try
+      {
+         ExoContainer container = ExoContainerContext.getCurrentContainer();
+         ObjectName containerObjectName = container.getScopingObjectName();
+         final String objectNameBase = (containerObjectName != null ? containerObjectName.toString() + "," : "exo:")+ "cache-name=" + cacheName;
+         return new JmxRegistrationManager(container.getMBeanServer(), parentCache, objectNameBase)
+         {
+            public String getObjectName(String resourceName)
+            {
+               return objectNameBase + JMX_RESOURCE_KEY + resourceName;
+            }
+         };
+      }
+      catch (Exception e)
+      {
+         LOG.error("Could not create the JMX Manager", e);
+      }
+      return null;
+   }
+   
+   /**
     * Add a list of creators to register
     * @param plugin the plugin that contains the creators
     */
@@ -398,5 +452,30 @@
             return false;
          return true;
       }
+   }
+
+   /**
+    * @see org.picocontainer.Startable#start()
+    */
+   public void start()
+   {
+   }
+
+   /**
+    * @see org.picocontainer.Startable#stop()
+    */
+   public void stop()
+   {
+      SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+      {
+         public Void run()
+         {
+            for (JmxRegistrationManager jmxManager : jmxManagers)
+            {
+               jmxManager.unregisterAllMBeans();
+            }
+            return null;
+         }
+      });
    }   
 }

Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -25,8 +25,12 @@
 import org.exoplatform.management.annotations.Managed;
 import org.exoplatform.management.annotations.ManagedDescription;
 import org.exoplatform.management.annotations.ManagedName;
+import org.exoplatform.management.jmx.impl.JMX;
 import org.exoplatform.management.jmx.impl.JMXManagementProvider;
+import org.exoplatform.management.jmx.impl.MBeanScopingData;
 import org.exoplatform.management.spi.ManagementProvider;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
 import org.picocontainer.ComponentAdapter;
 import org.picocontainer.PicoContainer;
 import org.picocontainer.PicoException;
@@ -36,9 +40,13 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.management.MBeanServer;
+import javax.management.ObjectName;
 
 /**
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
@@ -48,6 +56,11 @@
    extends CachingContainer
 {
 
+   /**
+    * The logger
+    */
+   private static final Log LOG = ExoLogger.getLogger("org.exoplatform.container.management.ManageableContainer");
+
    private static MBeanServer findMBeanServer()
    {
       J2EEServerInfo serverenv_ = new J2EEServerInfo();
@@ -64,6 +77,9 @@
    /** . */
    private MBeanServer server;
 
+   private volatile boolean objectNameSet;
+   private ObjectName objectName;
+   
    /** . */
    private final Set<ManagementProvider> providers;
 
@@ -157,6 +173,46 @@
       return server;
    }
 
+   /**
+    * Gives the ObjectName of the container build from the scoping data
+    * @return
+    */
+   public ObjectName getScopingObjectName()
+   {
+      if (!objectNameSet)
+      {
+         synchronized (this)
+         {
+            if (!objectNameSet)
+            {
+               Map<String, String> props = new LinkedHashMap<String, String>();
+
+               // Merge scoping properties
+               List<MBeanScopingData> list = managementContext.getScopingData(MBeanScopingData.class);
+               if (list != null && !list.isEmpty())
+               {
+                  // Read in revert order because wee received list of parents in upward order
+                  for (int i = list.size(); i > 0; i--)
+                  {
+                     MBeanScopingData scopingData = list.get(i - 1);
+                     props.putAll(scopingData);
+                  }               
+                  try
+                  {
+                     this.objectName = JMX.createObjectName("exo", props);
+                  }
+                  catch (Exception e)
+                  {
+                     LOG.error("Could not create the object name", e);
+                  }                  
+               }
+               this.objectNameSet = true;
+            }
+         }
+      }
+      return objectName;
+   }
+   
    public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
             throws PicoRegistrationException
    {

Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java	2011-05-27 12:48:48 UTC (rev 4444)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestPortalContainer.java	2011-05-27 18:05:10 UTC (rev 4445)
@@ -31,6 +31,19 @@
  */
 public class TestPortalContainer extends AbstractTestContainer
 {
+   
+   public void testHasScopingObjectName()
+   {
+      URL rootURL = getClass().getResource("empty-config.xml");
+      URL portalURL = getClass().getResource("empty-config.xml");
+      assertNotNull(rootURL);
+      assertNotNull(portalURL);
+      //
+      new ContainerBuilder().withRoot(rootURL).withPortal(portalURL).build();
+      assertNull(RootContainer.getInstance().getScopingObjectName());
+      assertNotNull(PortalContainer.getInstance().getScopingObjectName());
+   }
+
    public void testInitValues()
    {
       createRootContainer("portal-container-config-with-settings.xml");



More information about the exo-jcr-commits mailing list