Example usage for org.hibernate.cache.spi.access AccessType READ_WRITE

List of usage examples for org.hibernate.cache.spi.access AccessType READ_WRITE

Introduction

In this page you can find the example usage for org.hibernate.cache.spi.access AccessType READ_WRITE.

Prototype

AccessType READ_WRITE

To view the source code for org.hibernate.cache.spi.access AccessType READ_WRITE.

Click Source Link

Document

Read and write access (strict).

Usage

From source file:com.alachisoft.tayzgrid.integrations.hibernate.cache.TayzGridRegionFactory.java

License:Open Source License

/**
 * Get the default access type for {@link EntityRegion entity} and
 * {@link CollectionRegion collection} regions.
 *
 * @return This factory's default access type.
 *///from   w  ww. ja v a 2  s.co  m
@Override
public AccessType getDefaultAccessType() {
    return AccessType.READ_WRITE;
}

From source file:com.googlecode.hibernate.memcached.MemcachedRegionFactory.java

License:Apache License

public AccessType getDefaultAccessType() {
    return AccessType.READ_WRITE;
}

From source file:com.googlecode.hibernate.memcached.region.MemcachedCollectionRegion.java

License:Apache License

public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
    if (AccessType.READ_ONLY.equals(accessType)) {
        if (metadata.isMutable()) {
            log.warn("read-only cache configured for mutable entity [" + getName() + "]");
        }//from  w  ww  .  j av  a2s  . com
        return new ReadOnlyMemcachedCollectionRegionAccessStrategy(this, settings);
    } else if (AccessType.READ_WRITE.equals(accessType)) {
        return new ReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
    } else if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NonStrictReadWriteMemcachedCollectionRegionAccessStrategy(this, settings);
    } else if (AccessType.TRANSACTIONAL.equals(accessType)) {
        return new TransactionalMemcachedCollectionRegionAccessStrategy(this, cache, settings);
    } else {
        throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
    }
}

From source file:com.googlecode.hibernate.memcached.region.MemcachedEntityRegion.java

License:Apache License

public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {

    if (AccessType.READ_ONLY.equals(accessType)) {
        if (metadata.isMutable()) {
            log.warn("read-only cache configured for mutable entity [" + getName() + "]");
        }/*w  ww.  j  a  v  a2  s . c  o m*/
        return new ReadOnlyMemcachedEntityRegionAccessStrategy(this, settings);
    } else if (AccessType.READ_WRITE.equals(accessType)) {
        return new ReadWriteMemcachedEntityRegionAccessStrategy(this, settings);
    } else if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NonStrictReadWriteMemcachedEntityRegionAccessStrategy(this, settings);
    } else if (AccessType.TRANSACTIONAL.equals(accessType)) {
        return new TransactionalMemcachedEntityRegionAccessStrategy(this, cache, settings);
    } else {
        throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]");
    }
}

From source file:com.hazelcast.hibernate.CacheHitMissReadWriteTest.java

License:Open Source License

protected String getCacheStrategy() {
    return AccessType.READ_WRITE.getExternalName();
}

From source file:com.hazelcast.hibernate.region.HazelcastCollectionRegion.java

License:Open Source License

public CollectionRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (null == accessType) {
        throw new CacheException(
                "Got null AccessType while attempting to build CollectionRegionAccessStrategy. This can't happen!");
    }/*from www  .  j  a  v  a 2s .c o m*/
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new CollectionRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastCollectionRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new CollectionRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new CollectionRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastCollectionRegion>(this, props));
    }
    if (AccessType.TRANSACTIONAL.equals(accessType)) {
        throw new CacheException("Transactional access is not currently supported by Hazelcast.");
    }
    throw new CacheException("Got unknown AccessType " + accessType
            + " while attempting to build CollectionRegionAccessStrategy.");
}

From source file:com.hazelcast.hibernate.region.HazelcastEntityRegion.java

License:Open Source License

public EntityRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (null == accessType) {
        throw new CacheException(
                "Got null AccessType while attempting to determine a proper EntityRegionAccessStrategy. This can't happen!");
    }//  w w w.  ja  va 2  s.  c  o m
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new EntityRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastEntityRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new EntityRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastEntityRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new EntityRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastEntityRegion>(this, props));
    }
    if (AccessType.TRANSACTIONAL.equals(accessType)) {
        throw new CacheException("Transactional access is not currently supported by Hazelcast.");
    }
    throw new CacheException("Got unknown AccessType \"" + accessType
            + "\" while attempting to build EntityRegionAccessStrategy.");
}

From source file:com.hazelcast.hibernate.region.HazelcastNaturalIdRegion.java

License:Open Source License

public NaturalIdRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (null == accessType) {
        throw new CacheException(
                "Got null AccessType while attempting to determine a proper NaturalIdRegionAccessStrategy. "
                        + "This can't happen!");
    }//from www  .  j  a v a  2 s  . c  o  m
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.TRANSACTIONAL.equals(accessType)) {
        throw new CacheException("Transactional access is not currently supported by Hazelcast.");
    }
    throw new CacheException("Got unknown AccessType \"" + accessType
            + "\" while attempting to build EntityRegionAccessStrategy.");
}

From source file:com.hazelcast.hibernate4.region.HazelcastNaturalIdRegion.java

License:Open Source License

public NaturalIdRegionAccessStrategy buildAccessStrategy(final AccessType accessType) throws CacheException {
    if (null == accessType) {
        throw new CacheException(
                "Got null AccessType while attempting to determine a proper NaturalIdRegionAccessStrategy. This can't happen!");
    }/*from w  w  w  .  jav a 2  s.  c  o m*/
    if (AccessType.READ_ONLY.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadOnlyAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new NonStrictReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.READ_WRITE.equals(accessType)) {
        return new NaturalIdRegionAccessStrategyAdapter(
                new ReadWriteAccessDelegate<HazelcastNaturalIdRegion>(this, props));
    }
    if (AccessType.TRANSACTIONAL.equals(accessType)) {
        throw new CacheException("Transactional access is not currently supported by Hazelcast.");
    }
    throw new CacheException("Got unknown AccessType \"" + accessType
            + "\" while attempting to build EntityRegionAccessStrategy.");
}

From source file:com.oracle.coherence.hibernate.cache.access.AbstractCoherenceRegionAccessStrategyTest.java

License:CDDL license

/**
 * Returns a new CollectionReadWriteCoherenceRegionAccessStrategy.
 *
 * @return an CollectionReadWriteCoherenceRegionAccessStrategy
 *///  ww  w  .ja va  2 s .  com
protected CoherenceRegionAccessStrategy newCollectionReadWriteCoherenceRegionAccessStrategy() {
    return (CoherenceRegionAccessStrategy) getCoherenceCollectionRegion()
            .buildAccessStrategy(AccessType.READ_WRITE);
}