ClientRegionShortcut.valueOf(id);
public static void initializeClientRegionShortcuts(Cache cache) { for (ClientRegionShortcut shortcut : ClientRegionShortcut.values()) { switch (shortcut) { case LOCAL: { AttributesFactory<?, ?> af = new AttributesFactory(); af.setDataPolicy(DataPolicy.NORMAL); cache.setRegionAttributes(shortcut.toString(), af.create()); break; AttributesFactory<?, ?> af = new AttributesFactory(); af.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE); cache.setRegionAttributes(shortcut.toString(), af.create()); break; af.setDataPolicy(DataPolicy.NORMAL); af.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes()); cache.setRegionAttributes(shortcut.toString(), af.create()); break; af.setEvictionAttributes( EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK)); cache.setRegionAttributes(shortcut.toString(), af.create()); break; af.setEvictionAttributes( EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK)); cache.setRegionAttributes(shortcut.toString(), af.create()); break; (UserSpecifiedRegionAttributes) af.create();
/** * Determines whether the given {@link ClientRegionShortcut} is local only. * * @param shortcut {@link ClientRegionShortcut} to evaluate. * @return a boolean value indicating whether the {@link ClientRegionShortcut} is local or not. * @see org.apache.geode.cache.client.ClientRegionShortcut */ public static boolean isLocal(@Nullable ClientRegionShortcut shortcut) { return shortcut != null && shortcut.name().toLowerCase().contains("local"); }
/** * 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(); }
void createClientProxyRegions(ConfigurableListableBeanFactory beanFactory, Iterable<String> regionNames) { if (regionNames.iterator().hasNext()) { ClientRegionShortcut resolvedClientRegionShortcut = getClientRegionShortcut() .orElse(DEFAULT_CLIENT_REGION_SHORTCUT); ClientRegionFactory<?, ?> clientRegionFactory = this.clientCache.createClientRegionFactory(resolvedClientRegionShortcut); for (String regionName : regionNames) { if (beanFactory.containsBean(regionName)) { Object bean = beanFactory.getBean(regionName); logWarn("Cannot create a client {} Region bean named {}; A bean with name {} having type {} already exists", resolvedClientRegionShortcut.name(), regionName, regionName, ObjectUtils.nullSafeClassName(bean)); } else { logInfo("Creating Region bean with name {}...", regionName); beanFactory.registerSingleton(regionName, clientRegionFactory.create(regionName)); } } } }
/** * Converts the source String representation of a Client Region Shortcut into a ClientRegionShortcut enumerated * value. * * @param source the String representation of the Client Region Shortcut to convert. * @return a ClientRegionShortcut enumerated value for the String representation. * @throws IllegalArgumentException if the String source is not a valid ClientRegionShortcut enumerated value. * @see org.apache.geode.cache.client.ClientRegionShortcut#valueOf(String) */ @Override public ClientRegionShortcut convert(final String source) { return ClientRegionShortcut.valueOf(toUpperCase(source)); }
void createClientProxyRegions(ConfigurableListableBeanFactory beanFactory, Iterable<String> regionNames) { if (regionNames.iterator().hasNext()) { ClientRegionShortcut resolvedClientRegionShortcut = getClientRegionShortcut() .orElse(DEFAULT_CLIENT_REGION_SHORTCUT); ClientRegionFactory<?, ?> clientRegionFactory = this.clientCache.createClientRegionFactory(resolvedClientRegionShortcut); for (String regionName : regionNames) { if (beanFactory.containsBean(regionName)) { Object bean = beanFactory.getBean(regionName); logWarn("Cannot create a client {} Region bean named {}; A bean with name {} having type {} already exists", resolvedClientRegionShortcut.name(), regionName, regionName, ObjectUtils.nullSafeClassName(bean)); } else { logInfo("Creating Region bean with name {}...", regionName); beanFactory.registerSingleton(regionName, clientRegionFactory.create(regionName)); } } } }
/** * Converts the source String representation of a Client Region Shortcut into a ClientRegionShortcut enumerated * value. * * @param source the String representation of the Client Region Shortcut to convert. * @return a ClientRegionShortcut enumerated value for the String representation. * @throws IllegalArgumentException if the String source is not a valid ClientRegionShortcut enumerated value. * @see org.apache.geode.cache.client.ClientRegionShortcut#valueOf(String) */ @Override public ClientRegionShortcut convert(final String source) { return ClientRegionShortcut.valueOf(toUpperCase(source)); }
getClientRegionShortcut().name());
private void activateClientServer( GeodeEntityStoreConfiguration configuration ) throws IOException { Properties cacheProperties = buildCacheProperties( configuration ); String regionShortcutName = configuration.regionShortcut().get(); ClientRegionShortcut regionShortcut = regionShortcutName == null ? ClientRegionShortcut.PROXY : ClientRegionShortcut.valueOf( regionShortcutName ); String regionName = configuration.regionName().get(); ClientCacheFactory cacheFactory = new ClientCacheFactory( cacheProperties ); ClientCache cache = cacheFactory.create(); ClientRegionFactory<String, String> regionFactory = cache.createClientRegionFactory( regionShortcut ); region = regionFactory.create( regionName ); closeable = cache; }