[HHH-5332] (JndiInfinispanRegionFactory cannot be instantiated) Fixed.

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19784 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Galder Zamarreno 2010-06-22 23:52:38 +00:00
parent 03c182e14d
commit e7dce75a9f
3 changed files with 33 additions and 4 deletions

View File

@ -159,7 +159,7 @@ public class InfinispanRegionFactory implements RegionFactory {
/** {@inheritDoc} */
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata) throws CacheException {
log.debug("Building collection cache region [" + regionName + "]");
if (log.isDebugEnabled()) log.debug("Building collection cache region [" + regionName + "]");
Cache cache = getCache(regionName, COLLECTION_KEY, properties);
CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(cache);
CollectionRegionImpl region = new CollectionRegionImpl(cacheAdapter, regionName, metadata, transactionManager, this);
@ -182,7 +182,7 @@ public class InfinispanRegionFactory implements RegionFactory {
*/
public QueryResultsRegion buildQueryResultsRegion(String regionName, Properties properties)
throws CacheException {
log.debug("Building query results cache region [" + regionName + "]");
if (log.isDebugEnabled()) log.debug("Building query results cache region [" + regionName + "]");
String cacheName = typeOverrides.get(QUERY_KEY).getCacheName();
CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(manager.getCache(cacheName));
QueryResultsRegionImpl region = new QueryResultsRegionImpl(cacheAdapter, regionName, properties, transactionManager, this);
@ -195,7 +195,7 @@ public class InfinispanRegionFactory implements RegionFactory {
*/
public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
throws CacheException {
log.debug("Building timestamps cache region [" + regionName + "]");
if (log.isDebugEnabled()) log.debug("Building timestamps cache region [" + regionName + "]");
String cacheName = typeOverrides.get(TIMESTAMPS_KEY).getCacheName();
CacheAdapter cacheAdapter = CacheAdapterImpl.newInstance(manager.getCache(cacheName));
TimestampsRegionImpl region = new TimestampsRegionImpl(cacheAdapter, regionName, transactionManager, this);

View File

@ -51,7 +51,15 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
* There is no default value -- the user must specify the property.
*/
public static final String CACHE_MANAGER_RESOURCE_PROP = "hibernate.cache.infinispan.cachemanager";
public JndiInfinispanRegionFactory() {
super();
}
public JndiInfinispanRegionFactory(Properties props) {
super(props);
}
@Override
protected CacheManager createCacheManager(Properties properties) throws CacheException {
String name = PropertiesHelper.getString(CACHE_MANAGER_RESOURCE_PROP, properties, null);

View File

@ -0,0 +1,21 @@
package org.hibernate.test.cache.infinispan;
import junit.framework.TestCase;
import org.hibernate.cfg.SettingsFactory;
import java.util.Properties;
/**
* // TODO: Document this
*
* @author Galder Zamarreño
* @since // TODO
*/
public class JndiInfinispanRegionFactoryTestCase extends TestCase {
public void testConstruction() {
Properties p = new Properties();
p.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.infinispan.JndiInfinispanRegionFactory");
SettingsFactory.createRegionFactory(p, true);
}
}