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

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

Introduction

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

Prototype

AccessType NONSTRICT_READ_WRITE

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

Click Source Link

Document

Read and write access (non-strict).

Usage

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() + "]");
        }/*  w w w .j a  va  2  s  .c o  m*/
        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  w  w .j a v  a2s . 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.CacheHitMissNonStrictTest.java

License:Open Source License

protected String getCacheStrategy() {
    return AccessType.NONSTRICT_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!");
    }/* ww w  . j  a v a2 s .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!");
    }/*  ww w  .j a v a2 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  .  jav  a2 s. co  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!");
    }//  ww  w . ja va  2s.  com
    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 CollectionNonstrictReadWriteCoherenceRegionAccessStrategy.
 *
 * @return an CollectionNonstrictReadWriteCoherenceRegionAccessStrategy
 *///from  w  w w.j ava 2s  .  c o  m
protected CoherenceRegionAccessStrategy newCollectionNonstrictReadWriteCoherenceRegionAccessStrategy() {
    return (CoherenceRegionAccessStrategy) getCoherenceCollectionRegion()
            .buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
}

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

License:CDDL license

/**
 * Returns a new EntityNonstrictReadWriteCoherenceRegionAccessStrategy.
 *
 * @return an EntityNonstrictReadWriteCoherenceRegionAccessStrategy
 *//* w  w  w. ja v a2 s  . co m*/
protected CoherenceRegionAccessStrategy newEntityNonstrictReadWriteCoherenceRegionAccessStrategy() {
    return (CoherenceRegionAccessStrategy) getCoherenceEntityRegion()
            .buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
}

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

License:CDDL license

/**
 * Returns a new NaturalIdNonstrictReadWriteCoherenceRegionAccessStrategy.
 *
 * @return an NaturalIdNonstrictReadWriteCoherenceRegionAccessStrategy
 *//*from   w  ww.  j  av  a2s. c  o m*/
protected CoherenceRegionAccessStrategy newNaturalIdNonstrictReadWriteCoherenceRegionAccessStrategy() {
    return (CoherenceRegionAccessStrategy) getCoherenceNaturalIdRegion()
            .buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
}