General code refactoring and cleanup.
This commit is contained in:
@@ -94,17 +94,17 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Region<K, V> lookupFallback(GemFireCache cache, String regionName) throws Exception {
|
||||
Assert.isTrue(cache instanceof Cache, "Unable to create regions from " + cache);
|
||||
protected Region<K, V> lookupFallback(GemFireCache gemfireCache, String regionName) throws Exception {
|
||||
Assert.isTrue(gemfireCache instanceof Cache, "Unable to create Regions from " + gemfireCache);
|
||||
|
||||
Cache c = (Cache) cache;
|
||||
Cache cache = (Cache) gemfireCache;
|
||||
|
||||
if (attributes != null) {
|
||||
AttributesFactory.validateAttributes(attributes);
|
||||
}
|
||||
|
||||
final RegionFactory<K, V> regionFactory = (attributes != null ? c.createRegionFactory(attributes) :
|
||||
c.<K, V> createRegionFactory());
|
||||
final RegionFactory<K, V> regionFactory = (attributes != null ? cache.createRegionFactory(attributes) :
|
||||
cache.<K, V> createRegionFactory());
|
||||
|
||||
if (hubId != null) {
|
||||
enableGateway = enableGateway == null ? true : enableGateway;
|
||||
|
||||
@@ -29,23 +29,27 @@ import org.w3c.dom.Element;
|
||||
* @author David Turanski
|
||||
*/
|
||||
class ReplicatedRegionParser extends AbstractRegionParser {
|
||||
|
||||
@Override
|
||||
protected Class<?> getRegionFactoryClass() {
|
||||
return ReplicatedRegionFactoryBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doParseRegion(Element element, ParserContext parserContext, BeanDefinitionBuilder builder,
|
||||
boolean subRegion) {
|
||||
|
||||
ParsingUtils.parseScope(element, builder);
|
||||
|
||||
BeanDefinitionBuilder attrBuilder = subRegion ? builder : BeanDefinitionBuilder
|
||||
.genericBeanDefinition(RegionAttributesFactoryBean.class);
|
||||
|
||||
super.doParseCommonRegionConfiguration(element, parserContext, builder, attrBuilder, subRegion);
|
||||
BeanDefinitionBuilder regionAttributesFactoryBuilder = (subRegion ? builder
|
||||
: BeanDefinitionBuilder.genericBeanDefinition(RegionAttributesFactoryBean.class));
|
||||
|
||||
super.doParseCommonRegionConfiguration(element, parserContext, builder, regionAttributesFactoryBuilder,
|
||||
subRegion);
|
||||
|
||||
if (!subRegion) {
|
||||
builder.addPropertyValue("attributes", attrBuilder.getBeanDefinition());
|
||||
builder.addPropertyValue("attributes", regionAttributesFactoryBuilder.getBeanDefinition());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getRegionFactoryClass() {
|
||||
return ReplicatedRegionFactoryBean.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user