All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tangosol.coherence.jcache.partitionedcache.PartitionedCacheConfiguration Maven / Gradle / Ivy

There is a newer version: 24.09.2
Show newest version
/*
 * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl.
 */
package com.tangosol.coherence.jcache.partitionedcache;

import com.tangosol.coherence.jcache.AbstractCoherenceBasedCompleteConfiguration;
import com.tangosol.coherence.jcache.CoherenceBasedCache;
import com.tangosol.coherence.jcache.CoherenceBasedCacheManager;
import com.tangosol.coherence.jcache.common.JCacheIdentifier;

import javax.cache.configuration.CompleteConfiguration;

/**
 * A {@link javax.cache.configuration.Configuration} for a
 * {@link javax.cache.Cache} based on a Coherence <distributed-scheme>
 * or more specifically a partitioned (aka: distributed)
 * {@link com.tangosol.net.NamedCache}.
 *
 * @param   the type of the keys
 * @param   the type of the values
 *
 * @author bo  2013.10.23
 * @since Coherence 12.1.3
 */
public class PartitionedCacheConfiguration
        extends AbstractCoherenceBasedCompleteConfiguration
    {
    // ----- constructors ---------------------------------------------------

    /**
     * Constructs a default {@link PartitionedCacheConfiguration}.
     */
    public PartitionedCacheConfiguration()
        {
        super();
        }

    /**
     * Constructs a {@link PartitionedCacheConfiguration} based on a
     * {@link CompleteConfiguration}.
     *
     * @param configuration  the {@link CompleteConfiguration}
     */
    public PartitionedCacheConfiguration(CompleteConfiguration configuration)
        {
        super(configuration);

        validate();
        }

    // ----- PartitionedCacheConfiguration interface ------------------------

    /**
     * Validates the {@link PartitionedCacheConfiguration}.
     */
    protected void validate()
        {
        if (!isStoreByValue())
            {
            throw new UnsupportedOperationException("Store by reference is not supported");
            }
        }

    // ----- CoherenceCacheConfiguration interface --------------------------

    @Override
    public CoherenceBasedCache createCache(CoherenceBasedCacheManager manager, String sJCacheName)
            throws IllegalArgumentException
        {
        return new PartitionedCache(manager, sJCacheName, this);
        }

    @Override
    public void destroyCache(CoherenceBasedCacheManager manager, String sJcacheName)
        {
        PartitionedCache.destroyCache(manager, new JCacheIdentifier(manager.getURI().toString(), sJcacheName));
        }
    }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy