/** * For internal use only. * * @since GemFire 6.5 */ protected RegionFactory(InternalCache cache) { this.cache = cache; this.attrsFactory = new AttributesFactory<K, V>(); }
/** * For internal use only. * * @since GemFire 6.5 */ protected RegionFactory(InternalCache cache, RegionAttributes ra) { this.cache = cache; this.attrsFactory = new AttributesFactory<K, V>(ra); }
/** * Returns region attributes for a <code>LOCAL</code> region */ protected RegionAttributes getRegionAttributes() { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); return factory.create(); }
public static Region createRegion(Region parentRegion, String regionName, Class valueConstraint) { try { AttributesFactory attributesFactory = new AttributesFactory(); if (valueConstraint != null) attributesFactory.setValueConstraint(valueConstraint); RegionAttributes regionAttributes = attributesFactory.create(); return parentRegion.createSubregion(regionName, regionAttributes); } catch (Exception e) { throw new AssertionError(e); } }
public static Region createRegion(String regionName, Class valueConstraint, boolean indexMaintenanceSynchronous) { try { AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(valueConstraint); attributesFactory.setIndexMaintenanceSynchronous(indexMaintenanceSynchronous); RegionAttributes regionAttributes = attributesFactory.create(); return cache.createRegion(regionName, regionAttributes); } catch (Exception e) { throw new AssertionError(e); } }
protected void createCache() throws CacheException { Properties p = new Properties(); p.setProperty(MCAST_PORT, "0"); // loner this.cache = (GemFireCacheImpl) CacheFactory.create(DistributedSystem.connect(p)); AttributesFactory<String, String> af = new AttributesFactory<>(); af.setScope(Scope.DISTRIBUTED_NO_ACK); af.setIndexMaintenanceSynchronous(true); this.region = this.cache.createRegion("TXTest", af.create()); this.txMgr = this.cache.getCacheTransactionManager(); }
private static RegionAttributes createClientDefaults() { AttributesFactory af = new AttributesFactory(); af.setScope(Scope.LOCAL); // af.setIgnoreJTA(true); In 6.6 and later releases client regions support JTA af.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); return af.create(); }
/** * This method creates a local region with all the default values. The cache created is a loner, * so this is only suitable for single VM tests. */ public static Region createLocalRegion(String regionName) throws RegionExistsException { AttributesFactory attr = new AttributesFactory(); attr.setScope(Scope.LOCAL); Region localRegion = createCache().createRegion(regionName, attr.create()); return localRegion; }
@Override public Region createRegion(String regionName, Class valueConstraint) { PartitionAttributesFactory paf = new PartitionAttributesFactory(); AttributesFactory af = new AttributesFactory(); af.setPartitionAttributes(paf.create()); af.setValueConstraint(valueConstraint); Region r1 = CacheUtils.createRegion(regionName, af.create(), false); return r1; }
static Region createRegion(String regionName, Class valueConstraint) throws Exception { AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(valueConstraint); RegionAttributes regionAttributes = attributesFactory.create(); Region region = _cache.createRegion(regionName, regionAttributes); return region; }
@Override public void run2() throws CacheException { RegionAttributes<Object, Object> ra = getRegionAttributes(); AttributesFactory<Object, Object> factory = new AttributesFactory<>(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } });
public static void createReplicatedRegionWithCacheLoaderAndAsyncEventQueue(String regionName, String asyncQueueIds) { AttributesFactory fact = new AttributesFactory(); addAsyncEventQueueIds(fact, asyncQueueIds); fact.setDataPolicy(DataPolicy.REPLICATE); // set the CacheLoader fact.setCacheLoader(new MyCacheLoader()); RegionFactory regionFactory = cache.createRegionFactory(fact.create()); Region r = regionFactory.create(regionName); assertNotNull(r); }
private void setUp() throws CacheException { this.ds = DistributedSystem.connect(new Properties()); this.cache = CacheFactory.create(ds); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(Portfolio.class); this.regionAttributes = attributesFactory.create(); this.qs = this.cache.getQueryService(); }
private RegionAttributes createRegionAttributes(boolean isConcurrencyChecksEnabled) { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); factory.setConcurrencyChecksEnabled(isConcurrencyChecksEnabled); // RegionAttributes ra = factory.create(); return ra; }
private RegionAttributes createRegionAttributes(boolean isConcurrencyChecksEnabled) { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.REPLICATE); factory.setConcurrencyChecksEnabled(isConcurrencyChecksEnabled); // RegionAttributes ra = factory.create(); return ra; }
@Before public void setup() { InternalCache internalCache = Fakes.cache(); InternalResourceManager resourceManager = mock(InternalResourceManager.class, RETURNS_DEEP_STUBS); when(internalCache.getInternalResourceManager()).thenReturn(resourceManager); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setPartitionAttributes( new PartitionAttributesFactory().setTotalNumBuckets(1).setRedundantCopies(1).create()); partitionedRegion = new PartitionedRegion(regionName, attributesFactory.create(), null, internalCache, mock(InternalRegionArguments.class)); }
private RegionAttributes createRegionAttributes(final boolean withPersistence, PartitionAttributes partitionAttributes) { AttributesFactory factory = new AttributesFactory(); if (withPersistence) { factory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION); } else { factory.setDataPolicy(DataPolicy.PARTITION); } factory.setPartitionAttributes(partitionAttributes); RegionAttributes ra = factory.create(); return ra; }
@Test public void testCopyConstructor() { AttributesFactory f1 = new AttributesFactory(); f1.setLockGrantor(true); RegionAttributes origAttrs = f1.create(); assertEquals(true, origAttrs.isLockGrantor()); AttributesFactory f2 = new AttributesFactory(origAttrs); RegionAttributes attrs = f2.create(); assertEquals(true, attrs.isLockGrantor()); }
public static void createPartitionedRegionAccessorWithAsyncEventQueue(String regionName, String asyncEventQueueId) { AttributesFactory fact = new AttributesFactory(); PartitionAttributesFactory pfact = new PartitionAttributesFactory(); pfact.setTotalNumBuckets(16); pfact.setLocalMaxMemory(0); fact.setPartitionAttributes(pfact.create()); Region r = cache.createRegionFactory(fact.create()).addAsyncEventQueueId(asyncEventQueueId) .create(regionName); // fact.create()).create(regionName); assertNotNull(r); }
public static void createPartitionedRegionWithCacheLoaderAndAsyncQueue(String regionName, String asyncEventQueueId) { AttributesFactory fact = new AttributesFactory(); PartitionAttributesFactory pfact = new PartitionAttributesFactory(); pfact.setTotalNumBuckets(16); fact.setPartitionAttributes(pfact.create()); // set the CacheLoader implementation fact.setCacheLoader(new MyCacheLoader()); Region r = cache.createRegionFactory(fact.create()).addAsyncEventQueueId(asyncEventQueueId) .create(regionName); assertNotNull(r); }