org.hibernate.cache.spi.access.EntityRegionAccessStrategy Java Examples

The following examples show how to use org.hibernate.cache.spi.access.EntityRegionAccessStrategy. 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: J2CacheAccessStrategyFactoryImpl.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
public EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType) {
    switch (accessType) {
        case READ_ONLY:
            if (entityRegion.getCacheDataDescription().isMutable()) {
                LOG.readOnlyCacheConfiguredForMutableEntity(entityRegion.getName());
            }
            return new ReadOnlyJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case READ_WRITE:
            return new ReadWriteJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case NONSTRICT_READ_WRITE:
            return new NonStrictReadWriteJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case TRANSACTIONAL:
            return new TransactionalJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getJ2Cache(), entityRegion.getSettings());
        default:
            throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");

    }

}
 
Example #2
Source File: EntityRegionImpl.java    From hibernate4-memcached with Apache License 2.0 6 votes vote down vote up
@Override
	public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
		switch ( accessType ) {
			case READ_ONLY:
				if ( getCacheDataDescription().isMutable() ) {
					LOG.warnf( "read-only cache configured for mutable entity [ %s ]", getName() );
				}
				return new ReadOnlyEntityRegionAccessStrategy( this );
			case READ_WRITE:
				return new ReadWriteEntityRegionAccessStrategy( this );
			case NONSTRICT_READ_WRITE:
				return new NonstrictReadWriteEntityRegionAccessStrategy( this );
			case TRANSACTIONAL:
//				throw new UnsupportedOperationException( "doesn't support this access strategy" );
				return new TransactionalEntityRegionAccessStrategy( this );

			default:
				throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
		}

	}
 
Example #3
Source File: RedissonEntityRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteEntityRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalEntityRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #4
Source File: RedissonEntityRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteEntityRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalEntityRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #5
Source File: RedissonEntityRegion.java    From redisson with Apache License 2.0 6 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (accessType == AccessType.READ_ONLY) {
        return new ReadOnlyEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.READ_WRITE) {
        return new ReadWriteEntityRegionAccessStrategy(settings, this, mapCache);
    }
    if (accessType == AccessType.NONSTRICT_READ_WRITE) {
        return new NonStrictReadWriteEntityRegionAccessStrategy(settings, this);
    }
    if (accessType == AccessType.TRANSACTIONAL) {
        return new TransactionalEntityRegionAccessStrategy(settings, this);
    }
    
    throw new CacheException("Unsupported access strategy: " + accessType);
}
 
Example #6
Source File: J2CacheAccessStrategyFactoryImpl.java    From J2Cache with Apache License 2.0 6 votes vote down vote up
public EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType) {
    switch (accessType) {
        case READ_ONLY:
            if (entityRegion.getCacheDataDescription().isMutable()) {
                LOG.readOnlyCacheConfiguredForMutableEntity(entityRegion.getName());
            }
            return new ReadOnlyJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case READ_WRITE:
            return new ReadWriteJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case NONSTRICT_READ_WRITE:
            return new NonStrictReadWriteJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getSettings());
        case TRANSACTIONAL:
            return new TransactionalJ2CacheEntityRegionAccessStrategy(entityRegion, entityRegion.getJ2Cache(), entityRegion.getSettings());
        default:
            throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");

    }

}
 
Example #7
Source File: EntityMemcachedRegion.java    From hibernate4-memcached with Apache License 2.0 5 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    switch (accessType) {
        case READ_ONLY:
            return new ReadOnlyEntityRegionAccessStrategy(this);
        case NONSTRICT_READ_WRITE:
            return new NonstrictReadWriteEntityRegionAccessStrategy(this);
        default:
            throw new CacheException("Unsupported access strategy : " + accessType + ".");
    }
}
 
Example #8
Source File: NonstopAccessStrategyFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType) {
    return new NonstopAwareEntityRegionAccessStrategy(this.actualFactory.createEntityRegionAccessStrategy(entityRegion, accessType), HibernateNonstopCacheExceptionHandler.getInstance());
}
 
Example #9
Source File: HibernateEntityRegion.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
 
Example #10
Source File: HibernateEntityRegion.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return new AccessStrategy(createAccessStrategy(accessType));
}
 
Example #11
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public NonstopAwareEntityRegionAccessStrategy(EntityRegionAccessStrategy actualStrategy, HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) {
    this.actualStrategy = actualStrategy;
    this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler;
}
 
Example #12
Source File: J2CacheEntityRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return this.getAccessStrategyFactory().createEntityRegionAccessStrategy( this, accessType );
}
 
Example #13
Source File: NonstopAwareEntityRegionAccessStrategy.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public NonstopAwareEntityRegionAccessStrategy(EntityRegionAccessStrategy actualStrategy, HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) {
    this.actualStrategy = actualStrategy;
    this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler;
}
 
Example #14
Source File: NonstopAccessStrategyFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType) {
    return new NonstopAwareEntityRegionAccessStrategy(actualFactory.createEntityRegionAccessStrategy(entityRegion, accessType), HibernateNonstopCacheExceptionHandler.getInstance());
}
 
Example #15
Source File: J2CacheEntityRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    return getAccessStrategyFactory().createEntityRegionAccessStrategy( this, accessType );
}
 
Example #16
Source File: J2CacheAccessStrategyFactory.java    From J2Cache with Apache License 2.0 votes vote down vote up
EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType); 
Example #17
Source File: J2CacheAccessStrategyFactory.java    From J2Cache with Apache License 2.0 votes vote down vote up
EntityRegionAccessStrategy createEntityRegionAccessStrategy(J2CacheEntityRegion entityRegion, AccessType accessType);