[jboss-cvs] JBossAS SVN: r75805 - in trunk/hibernate-int: src/main/org/jboss/hibernate/jmx and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 14 16:38:52 EDT 2008


Author: pferraro
Date: 2008-07-14 16:38:52 -0400 (Mon, 14 Jul 2008)
New Revision: 75805

Modified:
   trunk/hibernate-int/build.xml
   trunk/hibernate-int/pom.xml
   trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java
   trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java
Log:
[JBAS-5589] Update hibernate-int module to understand RegionFactory
Refactored deployedTreeCacheObjectName -> deployedCacheJndiName to imply JndiSharedCacheRegionFactory.
Added deployedCacheManagerJndiName to imply JndiMultiplexedCacheRegionFactory.
Added build dependency on hibernate-jbosscache2

Modified: trunk/hibernate-int/build.xml
===================================================================
--- trunk/hibernate-int/build.xml	2008-07-14 20:26:03 UTC (rev 75804)
+++ trunk/hibernate-int/build.xml	2008-07-14 20:38:52 UTC (rev 75805)
@@ -94,6 +94,7 @@
     <!-- Specify modules upon which this build depends -->
     <path id="dependentmodule.classpath">
       <path refid="jboss.cache.jbosscache.core.classpath"/>
+      <path refid="org.hibernate.classpath"/>
       <path refid="jboss.common.core.classpath"/>
       <path refid="jboss.common.logging.spi.classpath"/>
       <path refid="jboss.common.logging.log4j.classpath"/>

Modified: trunk/hibernate-int/pom.xml
===================================================================
--- trunk/hibernate-int/pom.xml	2008-07-14 20:26:03 UTC (rev 75804)
+++ trunk/hibernate-int/pom.xml	2008-07-14 20:38:52 UTC (rev 75805)
@@ -35,6 +35,10 @@
       <artifactId>jbosscache-core</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-jbosscache2</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.logging</groupId>
       <artifactId>jboss-logging-spi</artifactId>
     </dependency>

Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java	2008-07-14 20:26:03 UTC (rev 75804)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java	2008-07-14 20:38:52 UTC (rev 75805)
@@ -10,7 +10,7 @@
 import java.net.URL;
 import java.util.Date;
 import java.util.Properties;
-import javax.management.ObjectName;
+
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 
@@ -27,7 +27,6 @@
 import org.jboss.beans.metadata.api.model.FromContext;
 import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
 import org.jboss.hibernate.ListenerInjector;
-import org.jboss.hibernate.cache.DeployedTreeCacheProvider;
 import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
@@ -43,6 +42,7 @@
  * @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
  * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @author <a href="mailto:pferraro at redhat.com">Paul Ferraro</a>
  * @version <tt>$Revision$</tt>
  */
 public class Hibernate implements HibernateMBean
@@ -73,7 +73,9 @@
    private Boolean secondLevelCacheEnabled = Boolean.TRUE;
    private Boolean queryCacheEnabled;
    private String cacheProviderClass;
-   private ObjectName deployedTreeCacheObjectName;
+   private String cacheRegionFactoryClass;
+   private String deployedCacheJndiName;
+   private String deployedCacheManagerJndiName;
    private Boolean minimalPutsEnabled;
    private String cacheRegionPrefix;
    private Boolean structuredCacheEntriesEnabled;
@@ -293,6 +295,7 @@
       setUnlessNull( settings, Environment.DATASOURCE, datasourceName );
       setUnlessNull( settings, Environment.DIALECT, dialect );
       setUnlessNull( settings, Environment.CACHE_PROVIDER, cacheProviderClass );
+      setUnlessNull( settings, Environment.CACHE_REGION_FACTORY, cacheRegionFactoryClass );
       setUnlessNull( settings, Environment.CACHE_REGION_PREFIX, cacheRegionPrefix );
       setUnlessNull( settings, Environment.USE_MINIMAL_PUTS, minimalPutsEnabled );
       setUnlessNull( settings, Environment.HBM2DDL_AUTO, hbm2ddlAuto );
@@ -320,14 +323,27 @@
       );
       setUnlessNull( settings, Environment.TRANSACTION_STRATEGY, JTATransactionFactory.class.getName() );
 
-      if ( deployedTreeCacheObjectName != null )
+      if (this.deployedCacheJndiName != null)
       {
-         String objNameString = deployedTreeCacheObjectName.toString();
-         if ( objNameString != null && !"".equals( objNameString ) )
+         settings.setProperty(org.hibernate.cache.jbc2.builder.JndiSharedCacheInstanceManager.CACHE_RESOURCE_PROP, this.deployedCacheJndiName);
+         
+         // Implies shared cache region factory
+         if (!settings.containsKey(Environment.CACHE_REGION_FACTORY))
          {
-            settings.setProperty( DeployedTreeCacheProvider.OBJECT_NAME_PROP, objNameString );
+            settings.setProperty(Environment.CACHE_REGION_FACTORY, org.hibernate.cache.jbc2.JndiSharedJBossCacheRegionFactory.class.getName());
          }
       }
+      
+      if (this.deployedCacheManagerJndiName != null)
+      {
+         settings.setProperty(org.hibernate.cache.jbc2.builder.JndiMultiplexingCacheInstanceManager.CACHE_FACTORY_RESOURCE_PROP, this.deployedCacheManagerJndiName);
+         
+         // Implies multliplexed cache region factory
+         if (!settings.containsKey(Environment.CACHE_REGION_FACTORY))
+         {
+            settings.setProperty(Environment.CACHE_REGION_FACTORY, org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory.class.getName());
+         }
+      }
 
       settings.setProperty( Environment.FLUSH_BEFORE_COMPLETION, "true" );
       settings.setProperty( Environment.AUTO_CLOSE_SESSION, "true" );
@@ -713,6 +729,23 @@
       dirty = true;
    }
 
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#getCacheRegionFactoryClass()
+    */
+   public String getCacheRegionFactoryClass()
+   {
+      return this.cacheRegionFactoryClass;
+   }
+
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#setCacheRegionFactoryClass(java.lang.String)
+    */
+   public void setCacheRegionFactoryClass(String regionFactoryClass)
+   {
+      this.cacheRegionFactoryClass = regionFactoryClass;
+      dirty = true;
+   }
+
    public String getCacheRegionPrefix()
    {
       return cacheRegionPrefix;
@@ -787,16 +820,40 @@
       this.listenerInjector = listenerInjector;
    }
 
-   public ObjectName getDeployedTreeCacheObjectName()
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#getDeployedCacheJndiName()
+    */
+   public String getDeployedCacheJndiName()
    {
-      return deployedTreeCacheObjectName;
+      return this.deployedCacheJndiName;
    }
 
-   public void setDeployedTreeCacheObjectName(ObjectName deployedTreeCacheObjectName)
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#setDeployedCacheJndiName(java.lang.String)
+    */
+   public void setDeployedCacheJndiName(String name)
    {
-      this.deployedTreeCacheObjectName = deployedTreeCacheObjectName;
+      this.deployedCacheJndiName = name;
+      dirty = true;
    }
 
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#getDeployedCacheManagerJndiName()
+    */
+   public String getDeployedCacheManagerJndiName()
+   {
+      return this.deployedCacheManagerJndiName;
+   }
+
+   /**
+    * @see org.jboss.hibernate.jmx.HibernateMBean#setDeployedCacheManagerJndiName(java.lang.String)
+    */
+   public void setDeployedCacheManagerJndiName(String name)
+   {
+      this.deployedCacheManagerJndiName = name;
+      dirty = true;
+   }
+
    public Boolean getBatchVersionedDataEnabled()
    {
       return batchVersionedDataEnabled;

Modified: trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java
===================================================================
--- trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java	2008-07-14 20:26:03 UTC (rev 75804)
+++ trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java	2008-07-14 20:38:52 UTC (rev 75805)
@@ -8,7 +8,6 @@
 
 import java.net.URL;
 import java.util.Date;
-import javax.management.ObjectName;
 
 import org.hibernate.SessionFactory;
 
@@ -27,6 +26,7 @@
  * @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
  * @author <a href="mailto:dimitris at jboss.org">Dimitris Andreadis</a>
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ * @author <a href="mailto:pferraro at redhat.com">Paul Ferraro</a>
  */
 public interface HibernateMBean
 {
@@ -73,21 +73,37 @@
 	public void setSessionFactoryName(String sessionFactoryName);
 
 	/**
-	 * The JMX name of a {@link org.jboss.cache.TreeCache} MBean to be used as the second level cache.
-	 * <p/>
-	 * Note : only used when {@link #getCacheProviderClass} == {@link org.jboss.hibernate.cache.DeployedTreeCacheProvider}
+	 * The JNDI name of a {@link org.jboss.cache.Cache} to be used for all regions of the second-level cache.
+	 * <br/>
+	 * N.B. implies {@link #getCacheRegionFactoryClass()} == {@link org.hibernate.cache.jbc2.JndiSharedCacheRegionFactory}
 	 *
 	 * @return The current setting
 	 */
-	public ObjectName getDeployedTreeCacheObjectName();
+	public String getDeployedCacheJndiName();
 
 	/**
-	 * The JMX name of a {@link org.jboss.cache.TreeCache} MBean to be used as the second level cache.
+     * The JNDI name of a {@link org.jboss.cache.Cache} to be used for all regions of the second level cache.
 	 *
-	 * @param deployedTreeCacheObjectName The new mbean object name.
+	 * @param name The jndi name of the cache.
 	 */
-	public void setDeployedTreeCacheObjectName(ObjectName deployedTreeCacheObjectName);
+	public void setDeployedCacheJndiName(String name);
 
+    /**
+     * The JNDI name of a {@link org.jboss.cache.CacheManager} to be used for acquiring cache regions for the second-level cache.
+     * <br/>
+     * N.B. implies {@link #getCacheRegionFactoryClass()} == {@link org.hibernate.cache.jbc2.JndiMultiplexedCacheRegionFactory}
+     *
+     * @return The current setting
+     */
+    public String getDeployedCacheManagerJndiName();
+
+    /**
+     * The JNDI name of a {@link org.jboss.cache.CacheManager} to be used for acquiring cache regions for the second-level cache.
+     *
+     * @param name The jndi name of the cache manager.
+     */
+    public void setDeployedCacheManagerJndiName(String name);
+
 	/**
 	 * Retreive the service name of the managed stats mbean.
 	 * <p/>
@@ -359,7 +375,7 @@
 	public void setQuerySubstitutions(String querySubstitutions);
 
 	/**
-	 * The name of the {@link org.hibernate.cache.CacheProvider} implementation class to use for second level caching.
+	 * The name of the {@link org.hibernate.cache.CacheProvider} implementation class to use for second-level caching.
 	 *
 	 * @return The current setting value
 	 *
@@ -368,13 +384,29 @@
 	public String getCacheProviderClass();
 
 	/**
-	 * The name of the {@link org.hibernate.cache.CacheProvider} implementation class to use for second level caching.
+	 * The name of the {@link org.hibernate.cache.CacheProvider} implementation class to use for second-level caching.
 	 *
 	 * @param cacheProviderClass The new provider impl class name.
 	 */
 	public void setCacheProviderClass(String cacheProviderClass);
 
 	/**
+	 * The name of the {@link org.hibernate.cache.RegionFactory} implementation class to use for second-level caching.
+	 * 
+	 * @return The current setting value
+	 * 
+	 * @see org.hibernate.cfg.Environment#CACHE_REGION_FACTORY
+	 */
+	public String getCacheRegionFactoryClass();
+
+	/**
+     * The name of the {@link org.hibernate.cache.RegionFactory} implementation class to use for second-level caching.
+	 * 
+	 * @param regionFactoryClass The new cache region factory impl class name
+	 */
+	public void setCacheRegionFactoryClass(String regionFactoryClass);
+	
+	/**
 	 * The prefix to use for this session factory within the second level cache.
 	 *
 	 * @return The current setting value




More information about the jboss-cvs-commits mailing list