Java Code Examples for org.apache.geode.cache.GemFireCache#getRegion()
The following examples show how to use
org.apache.geode.cache.GemFireCache#getRegion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeodeUtils.java From calcite with Apache License 2.0 | 6 votes |
/** * Obtains a proxy pointing to an existing Region on the server * * @param cache {@link GemFireCache} instance to interact with the Geode server * @param regionName Name of the region to create proxy for. * @return Returns a Region proxy to a remote (on the Server) regions. */ public static synchronized Region createRegion(GemFireCache cache, String regionName) { Objects.requireNonNull(cache, "cache"); Objects.requireNonNull(regionName, "regionName"); Region region = REGION_MAP.get(regionName); if (region == null) { try { region = ((ClientCache) cache) .createClientRegionFactory(ClientRegionShortcut.PROXY) .create(regionName); } catch (IllegalStateException | RegionExistsException e) { // means this is a server cache (probably part of embedded testing // or clientCache is passed directly) region = cache.getRegion(regionName); } REGION_MAP.put(regionName, region); } return region; }
Example 2
Source File: RegionResolver.java From immutables with Apache License 2.0 | 5 votes |
/** * Resolve region using default {@link ContainerNaming#DEFAULT} naming convention. * @see org.apache.geode.cache.RegionService#getRegion(String) */ static RegionResolver defaultResolver(GemFireCache cache) { Objects.requireNonNull(cache, "cache"); return ctx -> { String name = ContainerNaming.DEFAULT.name(ctx); Region<Object, Object> region = cache.getRegion(name); if (region == null) { throw new IllegalArgumentException(String.format("Failed to find geode region for %s. " + "Region %s not found in %s cache", ctx.getName(), name, cache.getName())); } return region; }; }
Example 3
Source File: InlineCachingWithDatabaseIntegrationTests.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean @DependsOn("Customers") GemfireTemplate customersTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("/Customers")); }
Example 4
Source File: InlineCachingWithCassandraIntegrationTests.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean @DependsOn("Customers") GemfireTemplate customersTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("/Customers")); }
Example 5
Source File: EchoServerConfiguration.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean public GemfireTemplate echoTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion( RegionUtils.toRegionPath(EchoClientConfiguration.REGION_NAME))); }
Example 6
Source File: EchoClientConfiguration.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean public GemfireTemplate echoTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion(RegionUtils.toRegionPath(REGION_NAME))); }
Example 7
Source File: ExistingRegionTemplateByNameAutoConfigurationIntegrationTests.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean @DependsOn("Example") public GemfireTemplate exampleTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("/Example")); }
Example 8
Source File: ExistingRegionTemplateByRegionAutoConfigurationIntegrationTests.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean("TestTemplate") @DependsOn("Example") GemfireTemplate testTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("/Example")); }
Example 9
Source File: AutoConfiguredContinuousQueryIntegrationTests.java From spring-boot-data-geode with Apache License 2.0 | 4 votes |
@Bean @DependsOn("TemperatureReadings") GemfireTemplate temperatureReadingsTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("/TemperatureReadings")); }
Example 10
Source File: QueryClientConfig.java From spring-data-examples with Apache License 2.0 | 4 votes |
@Bean("customerTemplate") @DependsOn("Customers") protected GemfireTemplate configureCustomerTemplate(GemFireCache gemfireCache) { return new GemfireTemplate(gemfireCache.getRegion("Customers")); }