/** * @since GemFire 6.5 */ @Override public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(ClientRegionShortcut shortcut) { return new ClientRegionFactoryImpl<>(this, shortcut); }
@SuppressWarnings("unchecked") @Override public Region<K, V> create(String name) throws RegionExistsException { return getCache().basicCreateRegion(name, createRegionAttributes()); }
/** * Constructs a ClientRegionFactory by creating a DistributedSystem and a Cache. If no * DistributedSystem exists it creates a loner DistributedSystem, otherwise it uses the existing * DistributedSystem. A default pool will be used unless ... The region configuration is * initialized using a region attributes whose name was given as the refid. * * @param refid the name of the region attributes to use */ public ClientRegionFactoryImpl(InternalClientCache cache, String refid) { this.cache = cache; RegionAttributes ra = cache.getRegionAttributes(refid); if (ra == null) { throw new IllegalStateException( "The named region attributes \"" + refid + "\" has not been defined."); } this.attrsFactory = new AttributesFactory<K, V>(ra); initAttributeFactoryDefaults(); }
@SuppressWarnings("unchecked") @Override public Region<K, V> createSubregion(Region<?, ?> parent, String name) throws RegionExistsException { return ((InternalRegion) parent).createSubregion(name, createRegionAttributes()); }
private Pool getDefaultPool() { return getCache().getDefaultPool(); }
@SuppressWarnings("deprecation") private RegionAttributes<K, V> createRegionAttributes() { RegionAttributes<K, V> ra = this.attrsFactory.create(); if (isEmpty(ra.getPoolName()) || Objects.equals(GemFireCacheImpl.DEFAULT_POOL_NAME, ra.getPoolName())) { UserSpecifiedRegionAttributes<K, V> ura = (UserSpecifiedRegionAttributes<K, V>) ra; if (ura.requiresPoolName) { Pool dp = getDefaultPool(); if (dp != null) { this.attrsFactory.setPoolName(dp.getName()); ra = this.attrsFactory.create(); } else { throw new IllegalStateException("The poolName must be set on a client."); } } } return ra; } }
/** * Constructs a ClientRegionFactory by creating a DistributedSystem and a Cache. If no * DistributedSystem exists it creates a loner DistributedSystem, otherwise it uses the existing * DistributedSystem. A default pool will be used unless ... The Region configuration is * initialized using the given region shortcut. * * @param pra the region shortcut to use */ public ClientRegionFactoryImpl(InternalClientCache cache, ClientRegionShortcut pra) { this.cache = cache; RegionAttributes ra = cache.getRegionAttributes(pra.toString()); if (ra == null) { throw new IllegalStateException( "The region shortcut " + pra + " has been removed from " + cache.listRegionAttributes()); } this.attrsFactory = new AttributesFactory<K, V>(ra); initAttributeFactoryDefaults(); }
@Override public <K, V> ClientRegionFactory<K, V> createClientRegionFactory(String regionAttributesId) { return new ClientRegionFactoryImpl<>(this, regionAttributesId); }