/** * When a <code>client-cache</code> element is first encountered, we create a * {@link ClientCacheCreation}and fill it in appropriately */ private void startClientCache(Attributes atts) { if (this.cache != null) { throw new CacheXmlException("Only a single cache or client-cache element is allowed"); } this.cache = new ClientCacheCreation(true); String copyOnRead = atts.getValue(COPY_ON_READ); if (copyOnRead != null) { this.cache.setCopyOnRead(Boolean.valueOf(copyOnRead).booleanValue()); } stack.push(this.cache); } /**
/** * When a <code>client-cache</code> element is first encountered, we create a * {@link ClientCacheCreation}and fill it in appropriately */ private void startClientCache(Attributes atts) { if (this.cache != null) { throw new CacheXmlException("Only a single cache or client-cache element is allowed"); } this.cache = new ClientCacheCreation(true); String copyOnRead = atts.getValue(COPY_ON_READ); if (copyOnRead != null) { this.cache.setCopyOnRead(Boolean.valueOf(copyOnRead).booleanValue()); } stack.push(this.cache); } /**
/** Create an instance of a fake cache, which is used by * com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator * * @param cacheDef The description of the cache to create a fake * cache object for. * * @returns A fake cache (one that doesn't really exist, but contains * the appropriate cache settings). */ private static CacheCreation createFakeCache(CacheDefinition cacheDef) { CacheCreation fakeCache = new CacheCreation(); Boolean aBool = cacheDef.getCopyOnRead(); if (aBool != null) fakeCache.setCopyOnRead(aBool.booleanValue()); Integer anInt = cacheDef.getLockTimeout(); if (anInt != null) fakeCache.setLockTimeout(anInt.intValue()); anInt = cacheDef.getSearchTimeout(); if (anInt != null) fakeCache.setSearchTimeout(anInt.intValue()); return fakeCache; }
this.cache.setCopyOnRead(Boolean.valueOf(copyOnRead).booleanValue());
this.cache.setCopyOnRead(Boolean.valueOf(copyOnRead).booleanValue());
/** * Tests creating a cache with non-default lock-timeout, lock-lease, * and search-timeout. */ public void testNonDefaultCache() { CacheCreation cache = new CacheCreation(); cache.setLockTimeout(42); cache.setLockLease(43); cache.setSearchTimeout(44); if (getGemFireVersion().compareTo(CacheXml.VERSION_4_0) >= 0) { cache.setCopyOnRead(true); } testXml(cache); }
/** * Creates a generator for a default cache. */ private CacheXmlGenerator() { this.cache = null; this.useSchema = false; this.version = VERSION_LATEST; this.generateDefaults = true; this.creation = new CacheCreation(); creation.setLockLease(GemFireCacheImpl.DEFAULT_LOCK_LEASE); creation.setLockTimeout(GemFireCacheImpl.DEFAULT_LOCK_TIMEOUT); creation.setSearchTimeout(GemFireCacheImpl.DEFAULT_SEARCH_TIMEOUT); // No cache proxy creation.setIsServer(false); creation.setCopyOnRead(GemFireCacheImpl.DEFAULT_COPY_ON_READ); }
/** * Creates a new <code>CacheXmlGenerator</code> that generates XML * for a given <code>ClientCache</code>. */ private CacheXmlGenerator(ClientCache cache, boolean useSchema, String version, boolean includeKeysValues) { this.cache = (Cache)cache; this.useSchema = useSchema; this.version = version; this.includeKeysValues = includeKeysValues; this.generateDefaults = true; if (cache instanceof ClientCacheCreation) { this.creation = (ClientCacheCreation) cache; this.creation.startingGenerate(); } else { this.creation = new ClientCacheCreation(); if (generateDefaults() || cache.getCopyOnRead()) { this.creation.setCopyOnRead(cache.getCopyOnRead()); } } } /**
/** * Creates a generator for a default cache. */ private CacheXmlGenerator() { this.cache = null; this.useSchema = true; this.version = CacheXmlVersion.valueForVersion(VERSION_LATEST); this.generateDefaults = true; this.creation = new CacheCreation(); creation.setLockLease(GemFireCacheImpl.DEFAULT_LOCK_LEASE); creation.setLockTimeout(GemFireCacheImpl.DEFAULT_LOCK_TIMEOUT); creation.setSearchTimeout(GemFireCacheImpl.DEFAULT_SEARCH_TIMEOUT); // No cache proxy creation.setIsServer(false); creation.setCopyOnRead(GemFireCacheImpl.DEFAULT_COPY_ON_READ); }
/** * Creates a new <code>CacheXmlGenerator</code> that generates XML * for a given <code>ClientCache</code>. */ private CacheXmlGenerator(ClientCache cache, boolean useSchema, String version, boolean includeKeysValues) { this.cache = (Cache)cache; this.useSchema = useSchema; this.version = CacheXmlVersion.valueForVersion(version); this.includeKeysValues = includeKeysValues; this.generateDefaults = true; if (cache instanceof ClientCacheCreation) { this.creation = (ClientCacheCreation) cache; this.creation.startingGenerate(); } else { this.creation = new ClientCacheCreation(); if (generateDefaults() || cache.getCopyOnRead()) { this.creation.setCopyOnRead(cache.getCopyOnRead()); } } } /**
public void testNormalCache() throws CacheException { CacheCreation cache = new CacheCreation(); cache.setCopyOnRead(true); testXml(cache); GemFireCacheImpl c = (GemFireCacheImpl) getCache(); assertEquals(true, c.getCopyOnRead()); assertEquals(false, c.isClient()); for (RegionShortcut pra: RegionShortcut.values()) { assertNotNull(c.getRegionAttributes(pra.name())); } assertEquals(RegionShortcut.values().length, c.listRegionAttributes().size()); } public void testPARTITION() throws CacheException {
this.creation = new ClientCacheCreation(); if (generateDefaults() || cache.getCopyOnRead()) { this.creation.setCopyOnRead(cache.getCopyOnRead()); this.creation.setCopyOnRead(cache.getCopyOnRead()); this.creation.setCopyOnRead(cache.getCopyOnRead());
creation.setCopyOnRead(copyOnRead1); creation.setIsServer(isServer1); creation.setLockLease(lockLease1); creation.setCopyOnRead(copyOnRead2); creation.setIsServer(isServer2); creation.setLockLease(lockLease2);
this.creation = new ClientCacheCreation(); if (generateDefaults() || cache.getCopyOnRead()) { this.creation.setCopyOnRead(cache.getCopyOnRead()); this.creation.setCopyOnRead(cache.getCopyOnRead()); this.creation.setCopyOnRead(cache.getCopyOnRead());