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

com.gemstone.gemfire.cache.GemFireCache Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package com.gemstone.gemfire.cache;

import java.io.InputStream;
import java.util.Map;
import java.util.Properties;

import javax.naming.Context;

import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.control.ResourceManager;
import com.gemstone.gemfire.cache.hdfs.HDFSStore;
import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.pdx.PdxSerializer;

/**
 * GemFireCache represents the singleton cache that must be created
 * in order to use GemFire in a Java virtual machine.
 * Users must create either a {@link Cache} for a peer/server JVM
 * or a {@link ClientCache} for a client JVM.
 * Instances of this interface are created using one of the following methods:
 * 
    *
  • {@link CacheFactory#create()} creates a peer/server instance of {@link Cache}. *
  • {@link ClientCacheFactory#create()} creates a client instance of {@link ClientCache}. *
* * @since 6.5 * @author darrel */ public interface GemFireCache extends RegionService { /** Returns the name of this cache. * This method does not throw * CacheClosedException if the cache is closed. * @return the String name of this cache */ public String getName(); /** * Returns the distributed system used by this cache. * This method does not throw * CacheClosedException if the cache is closed. */ public DistributedSystem getDistributedSystem(); /** * Returns the ResourceManager for managing this cache's * resources. * * @return ResourceManager for managing this cache's resources * @since 6.0 */ public ResourceManager getResourceManager(); /** * Sets the "copy on read" feature for cache read operations. * * @since 4.0 */ public void setCopyOnRead(boolean copyOnRead); /** * Indicates whether the "copy on read" is enabled for this cache. * * @return true if "copy on read" is enabled, false otherwise. * * @since 4.0 */ public boolean getCopyOnRead(); /** * Returns the RegionAttributes with the given * id or null if no * RegionAttributes with that id exists. * * @see #setRegionAttributes * * @since 4.1 */ public RegionAttributes getRegionAttributes(String id); /** * Sets the id of the given * RegionAttributes. If a region attributes named * name already exists, the mapping will be overwritten * with attrs. However, changing the mapping will not * effect existing regions. * * @param id * The id of the region attributes * @param attrs * The attributes to associate with id. If * attrs is null, any existing * RegionAttributes associated with * id will be removed. * * @see #getRegionAttributes * * @since 4.1 */ public void setRegionAttributes(String id, RegionAttributes attrs); /** * Returns an unmodifiable mapping of ids to region attributes. The * keys of the map are {@link String}s and the values of the map are * {@link RegionAttributes}. * * @since 4.1 */ public Map> listRegionAttributes(); /** * Loads the cache configuration described in a declarative caching XML * file into this cache. If the XML describes a region that * already exists, any mutable region attributes, indexes, and * region entries that are defined in the XML are updated/added. * *

* * Because this method may perform a {@link Region#put(Object, Object) put} on a * Region, it declares that it throws a * TimeoutException, CacheWriterException, * GatewayException, * or RegionExistsException. * * @throws CacheXmlException * If the XML read from is does not conform to * the dtd or if an IOException occurs while * reading the XML. * * @since 4.1 */ public void loadCacheXml(InputStream is) throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException; /** * Gets the logging object for GemFire. * This method does not throw * CacheClosedException if the cache is closed. * @return the logging object */ public LogWriter getLogger(); /** * Gets the security logging object for GemFire. * This method does not throw * CacheClosedException if the cache is closed. * @return the security logging object */ public LogWriter getSecurityLogger(); /** * Returns the DiskStore by name or null if no disk store is found. * @param name the name of the disk store to find. If null then the * default disk store, if it exists, is returned. * @since 6.5 */ public DiskStore findDiskStore(String name); /** * Returns the HDFSStore by name or null if no hdfs store is found. * @param name the name of the hdfs store to find. * @since 6.5 */ public HDFSStore findHDFSStore(String name); /** * create diskstore factory * * @since 6.5 */ public DiskStoreFactory createDiskStoreFactory(); public GatewaySenderFactory createGatewaySenderFactory(); /** * Returns whether { @link PdxInstance} is preferred for PDX types instead of Java object. * @see com.gemstone.gemfire.cache.CacheFactory#setPdxReadSerialized(boolean) * @see com.gemstone.gemfire.cache.client.ClientCacheFactory#setPdxReadSerialized(boolean) * * @since 6.6 */ public boolean getPdxReadSerialized(); /** * Returns the PdxSerializer used by this cache, or null * if no PDX serializer is defined. * * @since 6.6 * @see CacheFactory#setPdxSerializer(PdxSerializer) * @see ClientCacheFactory#setPdxSerializer(PdxSerializer) */ public PdxSerializer getPdxSerializer(); /** * Returns the disk store used for PDX meta data * @since 6.6 * @see CacheFactory#setPdxDiskStore(String) * @see ClientCacheFactory#setPdxDiskStore(String) */ public String getPdxDiskStore(); /** * Returns true if the PDX metadata for this * cache is persistent * @since 6.6 * @see CacheFactory#setPdxPersistent(boolean) * @see ClientCacheFactory#setPdxPersistent(boolean) */ public boolean getPdxPersistent(); /** * Returns true if fields that are not read during PDX deserialization * should be ignored during the PDX serialization. * @since 6.6 * @see CacheFactory#setPdxIgnoreUnreadFields(boolean) * @see ClientCacheFactory#setPdxIgnoreUnreadFields(boolean) */ public boolean getPdxIgnoreUnreadFields(); /** * Get the CacheTransactionManager instance for this Cache. * * @return The CacheTransactionManager instance. * * @throws CacheClosedException if the cache is closed. * * @since 4.0 */ public CacheTransactionManager getCacheTransactionManager(); /** * Returns the JNDI context associated with the Cache. * @return javax.naming.Context * Added as part of providing JTA implementation in Gemfire. * * @since 4.0 */ public Context getJNDIContext(); /** * Returns the Declarable used to initialize this cache or null * if it does not have an initializer. * @since 6.6 */ public Declarable getInitializer(); /** * Returns the Properties used to initialize the cache initializer or * null if no initializer properties exist. * @since 6.6 */ public Properties getInitializerProps(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy