SGF-10
SGF-11 + changed default cache name from 'cache' to 'gemfire-cache' to prevent collision with other defaults
This commit is contained in:
@@ -49,7 +49,7 @@ class CacheParser extends AbstractSingleBeanDefinitionParser {
|
||||
throws BeanDefinitionStoreException {
|
||||
String name = super.resolveId(element, definition, parserContext);
|
||||
if (!StringUtils.hasText(name)) {
|
||||
name = "cache";
|
||||
name = "gemfire-cache";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class ClientRegionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String attr = element.getAttribute("cache-ref");
|
||||
// add cache reference (fallback to default if nothing is specified)
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "cache"));
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "gemfire-cache"));
|
||||
|
||||
ManagedList<Object> interests = new ManagedList<Object>();
|
||||
|
||||
|
||||
@@ -30,5 +30,6 @@ class GemfireNamespaceHandler extends NamespaceHandlerSupport {
|
||||
registerBeanDefinitionParser("replicated-region", new ReplicatedRegionParser());
|
||||
registerBeanDefinitionParser("partitioned-region", new PartitionedRegionParser());
|
||||
registerBeanDefinitionParser("client-region", new ClientRegionParser());
|
||||
registerBeanDefinitionParser("pool", new PoolParser());
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class PartitionedRegionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String attr = element.getAttribute("cache-ref");
|
||||
// add cache reference (fallback to default if nothing is specified)
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "cache"));
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "gemfire-cache"));
|
||||
|
||||
|
||||
// partition attributes
|
||||
|
||||
@@ -53,7 +53,7 @@ class ReplicatedRegionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
String attr = element.getAttribute("cache-ref");
|
||||
// add cache reference (fallback to default if nothing is specified)
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "cache"));
|
||||
builder.addPropertyReference("cache", (StringUtils.hasText(attr) ? attr : "gemfire-cache"));
|
||||
|
||||
// add attributes
|
||||
AttributesFactory af = new AttributesFactory();
|
||||
|
||||
@@ -32,7 +32,7 @@ Defines a GemFire Cache instance used for creating or retrieving 'regions'.
|
||||
<xsd:attribute name="id" type="xsd:ID" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the cache definition (by default "cache").]]></xsd:documentation>
|
||||
The name of the cache definition (by default "gemfire-cache").]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-xml-location" type="xsd:string" use="optional">
|
||||
@@ -128,10 +128,10 @@ The name of the region definition. If no specified, it will have the value of th
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
<xsd:attribute name="cache-ref" type="xsd:string" default="cache" use="optional">
|
||||
<xsd:attribute name="cache-ref" type="xsd:string" default="gemfire-cache" use="optional">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation><![CDATA[
|
||||
The name of the bean defining the GemFire cache (by default 'cache').
|
||||
The name of the bean defining the GemFire cache (by default 'gemfire-cache').
|
||||
]]></xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:attribute>
|
||||
|
||||
@@ -38,8 +38,8 @@ public class CacheNamespaceTest extends RecreatingContextTest {
|
||||
|
||||
@Test
|
||||
public void testBasicCache() throws Exception {
|
||||
assertTrue(ctx.containsBean("cache"));
|
||||
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&cache");
|
||||
assertTrue(ctx.containsBean("gemfire-cache"));
|
||||
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&gemfire-cache");
|
||||
assertNull(TestUtils.readField("cacheXml", cfb));
|
||||
assertNull(TestUtils.readField("properties", cfb));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user