org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext Java Examples

The following examples show how to use org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractDomainDataRegion.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public AbstractDomainDataRegion(
			DomainDataRegionConfig regionConfig,
			RegionFactory regionFactory,
			CacheKeysFactory defaultKeysFactory,
			DomainDataRegionBuildingContext buildingContext) {
//		super( regionFactory.qualify( regionConfig.getRegionName() ), regionFactory );
		super( regionConfig.getRegionName(), regionFactory );

		this.sessionFactory = buildingContext.getSessionFactory();

		if ( defaultKeysFactory == null ) {
			defaultKeysFactory = DefaultCacheKeysFactory.INSTANCE;
		}
		this.effectiveKeysFactory = buildingContext.getEnforcedCacheKeysFactory() != null
				? buildingContext.getEnforcedCacheKeysFactory()
				: defaultKeysFactory;
	}
 
Example #2
Source File: RedissonRegionFactory.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
protected DomainDataStorageAccess createDomainDataStorageAccess(DomainDataRegionConfig regionConfig,
        DomainDataRegionBuildingContext buildingContext) {
    String defaultKey = null;
    if (!regionConfig.getCollectionCaching().isEmpty()) {
        defaultKey = COLLECTION_DEF;
    } else if (!regionConfig.getEntityCaching().isEmpty()) {
        defaultKey = ENTITY_DEF;
    } else if (!regionConfig.getNaturalIdCaching().isEmpty()) {
        defaultKey = NATURAL_ID_DEF;
    } else {
        throw new IllegalArgumentException("Unable to determine entity cache type!");
    }
    
    RMapCache<Object, Object> mapCache = getCache(regionConfig.getRegionName(), buildingContext.getSessionFactory().getProperties(), defaultKey);
    return new RedissonStorage(mapCache, ((Redisson)redisson).getConnectionManager(), buildingContext.getSessionFactory().getProperties(), defaultKey);
}
 
Example #3
Source File: DomainDataRegionTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DomainDataRegionTemplate(
		DomainDataRegionConfig regionConfig,
		RegionFactory regionFactory,
		DomainDataStorageAccess storageAccess,
		CacheKeysFactory defaultKeysFactory,
		DomainDataRegionBuildingContext buildingContext) {
	super( regionConfig, regionFactory, defaultKeysFactory, buildingContext );
	this.storageAccess = storageAccess;

	// now the super-type calls will have access to the `DomainDataStorageAccess` reference
	completeInstantiation( regionConfig, buildingContext );
}
 
Example #4
Source File: AbstractDomainDataRegion.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Should be called at the end of the subtype's constructor, or at least after the
 * `#super(...)` (aka, this type's constructor) call.  It's a timing issue - we need access
 * to the DomainDataStorageAccess in DomainDataRegionTemplate but in methods initiated
 * (atm) from AbstractDomainDataRegion's constructor
 */
protected void completeInstantiation(
		DomainDataRegionConfig regionConfig,
		DomainDataRegionBuildingContext buildingContext) {
	log.tracef( "DomainDataRegion created [%s]; key-factory = %s", regionConfig.getRegionName(), effectiveKeysFactory );

	this.entityDataAccessMap = generateEntityDataAccessMap( regionConfig );
	this.naturalIdDataAccessMap = generateNaturalIdDataAccessMap( regionConfig );
	this.collectionDataAccessMap = generateCollectionDataAccessMap( regionConfig );

}
 
Example #5
Source File: DomainDataRegionImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("WeakerAccess")
public DomainDataRegionImpl(
		DomainDataRegionConfig regionConfig,
		RegionFactoryTemplate regionFactory,
		DomainDataStorageAccess domainDataStorageAccess,
		CacheKeysFactory defaultKeysFactory,
		DomainDataRegionBuildingContext buildingContext) {
	super(
			regionConfig,
			regionFactory,
			domainDataStorageAccess,
			defaultKeysFactory,
			buildingContext
	);
}
 
Example #6
Source File: RegionFactoryTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DomainDataRegion buildDomainDataRegion(
		DomainDataRegionConfig regionConfig,
		DomainDataRegionBuildingContext buildingContext) {
	verifyStarted();
	return new DomainDataRegionTemplate(
			regionConfig,
			this,
			createDomainDataStorageAccess( regionConfig, buildingContext ),
			getImplicitCacheKeysFactory(),
			buildingContext
	);
}
 
Example #7
Source File: HibernateRegionFactory.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override public DomainDataRegion buildDomainDataRegion(
    DomainDataRegionConfig regionCfg,
    DomainDataRegionBuildingContext buildingCtx) {
    return new IgniteDomainDataRegion(regionCfg, this, null, buildingCtx,
        accessStgyFactory);
}
 
Example #8
Source File: IgniteDomainDataRegion.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** */
public IgniteDomainDataRegion(DomainDataRegionConfig regionCfg,
    RegionFactory regionFactory,
    CacheKeysFactory defKeysFactory,
    DomainDataRegionBuildingContext buildingCtx,
    HibernateAccessStrategyFactory stgyFactory) {
    super(regionCfg, regionFactory, defKeysFactory, buildingCtx);

    this.stgyFactory = stgyFactory;

    cache = stgyFactory.regionCache(getName());

    completeInstantiation(regionCfg, buildingCtx);
}
 
Example #9
Source File: RedissonRegionFactory.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Override
public DomainDataRegion buildDomainDataRegion(
        DomainDataRegionConfig regionConfig,
        DomainDataRegionBuildingContext buildingContext) {
    verifyStarted();
    return new DomainDataRegionImpl(
            regionConfig,
            this,
            createDomainDataStorageAccess( regionConfig, buildingContext ),
            getImplicitCacheKeysFactory(),
            buildingContext
    );
}
 
Example #10
Source File: RegionFactoryTemplate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected DomainDataStorageAccess createDomainDataStorageAccess(
		DomainDataRegionConfig regionConfig,
		DomainDataRegionBuildingContext buildingContext) {
	throw new UnsupportedOperationException( "Not implemented by caching provider" );
}
 
Example #11
Source File: NoCachingRegionFactory.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DomainDataRegion buildDomainDataRegion(
		DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext) {
	throw new NoCacheRegionFactoryAvailableException();
}
 
Example #12
Source File: MemcachedRegionFactory.java    From hibernate-l2-memcached with Apache License 2.0 4 votes vote down vote up
@Override
public DomainDataRegion buildDomainDataRegion(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext) {
    return new DomainDataRegionImpl(regionConfig, this, createDomainDataStorageAccess(regionConfig, buildingContext), cacheKeysFactory, buildingContext);
}
 
Example #13
Source File: MemcachedRegionFactory.java    From hibernate-l2-memcached with Apache License 2.0 4 votes vote down vote up
@Override
protected DomainDataStorageAccess createDomainDataStorageAccess(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext) {
    return new StorageAccessImpl(getOrCreateCache(regionConfig.getRegionName(), buildingContext.getSessionFactory()));
}
 
Example #14
Source File: RegionFactory.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a named Region for holding domain model data
 *
 * @param regionConfig The user requested caching configuration for this Region
 * @param buildingContext Access to delegates useful in building the Region
 */
DomainDataRegion buildDomainDataRegion(
		DomainDataRegionConfig regionConfig,
		DomainDataRegionBuildingContext buildingContext);