All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.cache.infinispan.naturalid.NaturalIdRegionImpl Maven / Gradle / Ivy

There is a newer version: 5.6.15.Final
Show newest version
package org.hibernate.cache.infinispan.naturalid;

import javax.transaction.TransactionManager;

import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.access.PutFromLoadValidator;
import org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion;
import org.hibernate.cache.infinispan.util.CacheAdapter;
import org.hibernate.cache.spi.CacheDataDescription;
import org.hibernate.cache.spi.NaturalIdRegion;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;

/**
 * @author Strong Liu 
 */
public class NaturalIdRegionImpl extends BaseTransactionalDataRegion implements NaturalIdRegion {
	public NaturalIdRegionImpl(CacheAdapter cacheAdapter,
							   String name, CacheDataDescription metadata,
							   TransactionManager transactionManager, RegionFactory factory) {
		super( cacheAdapter, name, metadata, transactionManager, factory );
	}

	@Override
	public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
		if (AccessType.READ_ONLY.equals(accessType)) {
			return new ReadOnlyAccess(this);
		} else if (AccessType.TRANSACTIONAL.equals(accessType)) {
			return new TransactionalAccess(this);
		}
		throw new CacheException("Unsupported access type [" + accessType.getExternalName() + "]");
	}

	public PutFromLoadValidator getPutFromLoadValidator() {
		return new PutFromLoadValidator(transactionManager);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy