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

org.apache.geode.cache.GemFireCache Maven / Gradle / Ivy

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for additional information regarding
 * copyright ownership. The ASF licenses this file to You 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.
 */

package org.apache.geode.cache;

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

import javax.naming.Context;

import org.apache.geode.LogWriter;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.control.ResourceManager;
import org.apache.geode.cache.wan.GatewaySenderFactory;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.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 GemFire 6.5 */ 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 GemFire 6.0 */ public ResourceManager getResourceManager(); /** * Sets the "copy on read" feature for cache read operations. * * @since GemFire 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 GemFire 4.0 */ public boolean getCopyOnRead(); /** * Returns the RegionAttributes with the given id or null * if no RegionAttributes with that id exists. * * @see #setRegionAttributes * * @since GemFire 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 GemFire 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 GemFire 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 GemFire 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 GemFire 6.5 */ public DiskStore findDiskStore(String name); /** * create diskstore factory * * @since GemFire 6.5 */ public DiskStoreFactory createDiskStoreFactory(); public GatewaySenderFactory createGatewaySenderFactory(); /** * Returns whether { @link PdxInstance} is preferred for PDX types instead of Java object. * * @see org.apache.geode.cache.CacheFactory#setPdxReadSerialized(boolean) * @see org.apache.geode.cache.client.ClientCacheFactory#setPdxReadSerialized(boolean) * * @since GemFire 6.6 */ public boolean getPdxReadSerialized(); /** * Returns the PdxSerializer used by this cache, or null if no PDX serializer is defined. * * @since GemFire 6.6 * @see CacheFactory#setPdxSerializer(PdxSerializer) * @see ClientCacheFactory#setPdxSerializer(PdxSerializer) */ public PdxSerializer getPdxSerializer(); /** * Returns the disk store used for PDX meta data * * @since GemFire 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 GemFire 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 GemFire 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 GemFire 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 GemFire 4.0 */ public Context getJNDIContext(); /** * Returns the Declarable used to initialize this cache or null if it does not have * an initializer. * * @since GemFire 6.6 */ public Declarable getInitializer(); /** * Returns the Properties used to initialize the cache initializer or null if no * initializer properties exist. * * @since GemFire 6.6 */ public Properties getInitializerProps(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy