Package com.sparc.knappsack.components.cache

Source Code of com.sparc.knappsack.components.cache.KnappsackCacheRegionFactory

package com.sparc.knappsack.components.cache;

import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.hibernate.HazelcastCacheRegionFactory;
import org.hibernate.cache.*;
import org.hibernate.cache.spi.*;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.Settings;

import java.util.Properties;

public class KnappsackCacheRegionFactory extends KnappsackAbstractCache implements RegionFactory {

    private HazelcastCacheRegionFactory hazelcastCacheRegionFactory;

    public KnappsackCacheRegionFactory() {
        Config config = getConfig();
        this.hazelcastCacheRegionFactory = new HazelcastCacheRegionFactory(Hazelcast.newHazelcastInstance(config));
    }

    @Override
    public void start(Settings settings, Properties properties) throws CacheException {
        hazelcastCacheRegionFactory.start(settings, properties);
    }

    @Override
    public void stop() {
        hazelcastCacheRegionFactory.stop();
    }

    @Override
    public boolean isMinimalPutsEnabledByDefault() {
        return hazelcastCacheRegionFactory.isMinimalPutsEnabledByDefault();
    }

    @Override
    public AccessType getDefaultAccessType() {
        return hazelcastCacheRegionFactory.getDefaultAccessType();
    }

    @Override
    public long nextTimestamp() {
        return hazelcastCacheRegionFactory.nextTimestamp();
    }

    @Override
    public EntityRegion buildEntityRegion(String s, Properties properties, CacheDataDescription cacheDataDescription) throws CacheException {
        return hazelcastCacheRegionFactory.buildEntityRegion(s, properties, cacheDataDescription);
    }

    @Override
    public NaturalIdRegion buildNaturalIdRegion(String s, Properties properties, CacheDataDescription cacheDataDescription) throws CacheException {
        return hazelcastCacheRegionFactory.buildNaturalIdRegion(s, properties, cacheDataDescription);
    }

    @Override
    public CollectionRegion buildCollectionRegion(String s, Properties properties, CacheDataDescription cacheDataDescription) throws CacheException {
        return hazelcastCacheRegionFactory.buildCollectionRegion(s, properties, cacheDataDescription);
    }

    @Override
    public QueryResultsRegion buildQueryResultsRegion(String s, Properties properties) throws CacheException {
        return hazelcastCacheRegionFactory.buildQueryResultsRegion(s, properties);
    }

    @Override
    public TimestampsRegion buildTimestampsRegion(String s, Properties properties) throws CacheException {
        return hazelcastCacheRegionFactory.buildTimestampsRegion(s, properties);
    }
}
TOP

Related Classes of com.sparc.knappsack.components.cache.KnappsackCacheRegionFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.