SGF-768 - Replace all SDG XML schema (XSD) references with Asciidoc variables.

This commit is contained in:
John Blum
2018-07-23 13:14:36 -07:00
parent 185bc0949d
commit cf4b4d6cd3
9 changed files with 110 additions and 90 deletions

View File

@@ -2,5 +2,5 @@
[appendix]
= Spring Data for {data-store-name} Schema
* http://www.springframework.org/schema/gemfire/spring-gemfire.xsd[Spring Data for {data-store-name} Core Schema (`gfe` namespace)]
* http://www.springframework.org/schema/gemfire/spring-data-gemfire.xsd[Spring Data for {data-store-name} Data Access Schema (`gfe-data` namespace)]
* {spring-data-schema-location}[Spring Data for {data-store-name} Core Schema (`gfe` namespace)]
* {spring-data-access-schema-location}[Spring Data for {data-store-name} Data Access Schema (`gfe-data` namespace)]

View File

@@ -22,9 +22,13 @@ Costin Leau; David Turanski; John Blum; Oliver Gierke; Jay Bryant
:pivotal-gemfire-javadoc: http://gemfire-{pivotal-gemfire-version}-javadocs.docs.pivotal.io/
:pivotal-gemfire-website: https://pivotal.io/pivotal-gemfire
:sdg-name: Spring Data for {data-store-name}
:spring-data-access-schema-location: http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd
:spring-data-access-schema-namespace: http://www.springframework.org/schema/data/gemfire
:spring-data-commons-docs: https://docs.spring.io/spring-data/commons/docs/current/reference
:spring-data-commons-docs-html: {spring-data-commons-docs}/html
:spring-data-commons-javadoc: https://docs.spring.io/spring-data/commons/docs/current/api
:spring-data-schema-location: http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
:spring-data-schema-namespace: http://www.springframework.org/schema/gemfire
:spring-data-website: https://spring.io/projects/spring-data
:spring-framework-docs: https://docs.spring.io/spring/docs/current/spring-framework-reference
:spring-framework-javadoc: https://docs.spring.io/spring/docs/current/javadoc-api

View File

@@ -51,14 +51,16 @@ To use the Spring Data for {data-store-name} XML namespace, declare it in your S
as the following example shows:
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/geode"<!--1--><!--2-->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
xmlns:gfe="{spring-data-schema-namespace}" <!--1--><!--2-->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/geode http://www.springframework.org/schema/gemfire/spring-geode.xsd"> <!--3-->
{spring-data-schema-namespace} {spring-data-schema-location} <!--3-->
">
<bean id ... >
@@ -80,14 +82,16 @@ composed mainly of {data-store-name} components, as it avoids declaring the pref
prefix declaration shown earlier, as the following example shows:
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/geode" <!--1-->
xmlns:beans="http://www.springframework.org/schema/beans" <!--2-->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
<beans xmlns="{spring-data-schema-namespace}" <!--1-->
xmlns:beans="http://www.springframework.org/schema/beans" <!--2-->
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/geode http://www.springframework.org/schema/gemfire/spring-geode.xsd">
{spring-data-schema-namespace} {spring-data-schema-location}
">
<beans:bean id ... > <!--3-->

View File

@@ -57,16 +57,18 @@ For example, you can use the `properties` element defined in the `util` namespac
directly or load properties from a properties file, as follows:
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
{spring-data-schema-namespace} {spring-data-schema-location}
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
">
<util:properties id="gemfireProperties" location="file:/path/to/gemfire.properties"/>
@@ -230,7 +232,7 @@ Again, to enable this feature, specify the following in the Spring XML config:
[source,xml]
----
<gfe:cache use-cluster-configuration="true"/>
<gfe:cache use-cluster-configuration="true"/>
----
NOTE: While certain {data-store-name} tools, such as `Gfsh`, have their actions "`recorded`" when schema-like changes are made
@@ -248,16 +250,17 @@ Spring Data for {data-store-name} includes dedicated support for configuring a
allowing complete configuration through the Spring container, as the following example shows:
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
{spring-data-schema-namespace} {spring-data-schema-location}
">
<gfe:cache/>

View File

@@ -83,14 +83,15 @@ NOTE: the class does not have to implement an interface; an interface is only us
between the contract and the implementation.
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
{spring-data-schema-namespace} {spring-data-schema-location}
">
<gfe:client-cache/>

View File

@@ -136,7 +136,7 @@ NOTE: #1 above is independent of your Spring [Boot] and/or [Data for {data-store
and must be completed successfully.
2) Referring to Step 5 in {data-store-name}'s http://gemfire90.docs.pivotal.io/geode/developing/transactions/JTA_transactions.html#concept_csy_vfb_wk[documentation],
_Spring Data for {data-store-name}'s_ Annotation support will attempt to set the `GemFireCache`, {x-data-store-javadoc}/org/apache/geode/cache/GemFireCache.html#setCopyOnRead-boolean-[`copyOnRead`]
Spring Data for {data-store-name}'s Annotation support will attempt to set the `GemFireCache`, {x-data-store-javadoc}/org/apache/geode/cache/GemFireCache.html#setCopyOnRead-boolean-[`copyOnRead`]
property for you when using the `@EnableGemFireAsLastResource` annotation.
However, if SDG's auto-configuration is unsuccessful then you must explicitly set the `copy-on-read` attribute on the
@@ -147,46 +147,46 @@ Peer Cache XML:
[source,xml]
----
<gfe:cache ... copy-on-read="true"/>
<gfe:cache ... copy-on-read="true"/>
----
Peer Cache JavaConfig:
[source,java]
----
@Bean
CacheFacatoryBean gemfireCache() {
@Bean
CacheFacatoryBean gemfireCache() {
CacheFactoryBean gemfireCache = new CacheFactoryBean();
CacheFactoryBean gemfireCache = new CacheFactoryBean();
gemfireCache.setClose(true);
gemfireCache.setCopyOnRead(true);
gemfireCache.setClose(true);
gemfireCache.setCopyOnRead(true);
return gemfireCache;
}
return gemfireCache;
}
----
Client Cache XML:
[source,xml]
----
<gfe:client-cache ... copy-on-read="true"/>
<gfe:client-cache ... copy-on-read="true"/>
----
Client Cache JavaConfig:
[source,java]
----
@Bean
ClientCacheFacatoryBean gemfireCache() {
@Bean
ClientCacheFacatoryBean gemfireCache() {
ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();
ClientCacheFactoryBean gemfireCache = new ClientCacheFactoryBean();
gemfireCache.setClose(true);
gemfireCache.setCopyOnRead(true);
gemfireCache.setClose(true);
gemfireCache.setCopyOnRead(true);
return gemfireCache;
}
return gemfireCache;
}
----
NOTE: explicitly setting the `copy-on-read` attribute or optionally the `copyOnRead` property
@@ -196,7 +196,7 @@ really should not be necessary.
and let _Spring Data Geode_ work its magic. All you need do is annotate your Spring `@Configuration` class
with Spring Data for {data-store-name}'s *new* `@EnableGemFireAsLastResource` annotation and a combination of Spring's
http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#transaction[Transaction Management]
infrastructure and _Spring Data for {data-store-name}'s_ `@EnableGemFireAsLastResource` configuration does the trick.
infrastructure and Spring Data for {data-store-name}'s `@EnableGemFireAsLastResource` configuration does the trick.
The configuration looks like this...
@@ -236,14 +236,14 @@ public JtaTransactionManager transactionManager(UserTransaction userTransaction)
----
NOTE: The configuration in section <<apis:transaction-management>> does *not* apply here.
The use of _Spring Data for {data-store-name}'s_ `GemfireTransactionManager` is applicable only in "Local", Cache Transactions,
The use of Spring Data for {data-store-name}'s `GemfireTransactionManager` is applicable only in "Local", Cache Transactions,
*not* "Global", JTA Transactions. Therefore, you do *not* configure the SDG `GemfireTransactionManager` in this case.
You configure Spring's `JtaTransactionManager` as shown above.
For more details on using _Spring's Transaction Management_ with JTA,
see http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#transaction-application-server-integration[here].
Effectively, _Spring Data for {data-store-name}'s_ `@EnableGemFireAsLastResource` annotation imports configuration containing 2 Aspect
Effectively, Spring Data for {data-store-name}'s `@EnableGemFireAsLastResource` annotation imports configuration containing 2 Aspect
bean definitions that handles the {data-store-name} `o.a.g.ra.GFConnectionFactory.getConnection()`
and `o.a.g.ra.GFConnection.close()` operations at the appropriate points during the transactional operation.
@@ -272,7 +272,7 @@ Thankfully, Spring does the heavy lifting for you and all you need do after appl
class MyTransactionalService ... {
@Transactional
public <Return-Type> someTransactionalMethod() {
public <Return-Type> someTransactionalServiceMethod() {
// perform business logic interacting with and accessing multiple JTA resources atomically, here
}
@@ -281,7 +281,7 @@ class MyTransactionalService ... {
----
#1 & #4 above are appropriately handled for you by Spring's JTA based `PlatformTransactionManager` once the
`@Transactional` boundary is entered by your application (i.e. when the `MyTransactionSerivce.someTransactionalMethod()`
`@Transactional` boundary is entered by your application (i.e. when the `MyTransactionSerivce.someTransactionalServiceMethod()`
is called).
#2 & #3 are handled by Spring Data for {data-store-name}'s new Aspects enabled with the `@EnableGemFireAsLastResource` annotation.
@@ -408,7 +408,7 @@ class DBLoader extends WiringDeclarableSupport implements CacheLoader {
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
">
<bean id="dataSource" ... />
@@ -440,7 +440,7 @@ one can pass in the `bean-name` parameter in the {data-store-name} configuration
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
">
<bean id="dataSource" ... />
@@ -497,8 +497,8 @@ class DBLoader extends WiringDeclarableSupport implements CacheLoader {
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
">
<!-- enable annotation processing -->
@@ -524,15 +524,18 @@ To use {data-store-name} as a backing implementation, a "_caching provider_" _in
simply add `GemfireCacheManager` to your configuration:
[source,xml]
[subs="verbatim,attributes"]
----
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
{spring-data-schema-namespace} {spring-data-schema-location}
">
<!-- enable declarative caching -->
<cache:annotation-driven/>
@@ -575,15 +578,18 @@ Then you will need the following config.
XML:
[source,xml]
[subs="verbatim,attributes"]
----
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
{spring-data-schema-namespace} {spring-data-schema-location}
">
<!-- enable declarative caching -->
<cache:annotation-driven/>

View File

@@ -363,16 +363,14 @@ The following example shows the `Predicate` API in use:
[source,java]
----
Predicate<Class<?>> customerTypes =
type -> Customer.class.getPackage().getName().startsWith(type.getName());
Predicate<Class<?>> customerTypes =
type -> Customer.class.getPackage().getName().startsWith(type.getName());
Predicate typeFilters = customerTypes
.or(type -> User.class.isAssignble(type)) // Include User sub-types (e.g. Admin, Guest, etc)
.and(type -> !Reference.class.getPackage(type.getPackage()); // Exclude all Reference types
mappingPdxSerializer.setTypeFilters(typeFilters);
Predicate typeFilters = customerTypes
.or(type -> User.class.isAssignble(type)) // Include User sub-types (e.g. Admin, Guest, etc)
.and(type -> !Reference.class.getPackage(type.getPackage()); // Exclude all Reference types
mappingPdxSerializer.setTypeFilters(typeFilters);
----
NOTE: In addition to setting your own type filtering `Predicates`, SDG's `MappingPdxSerializer` now automatically

View File

@@ -70,9 +70,9 @@ For instance, consider the following `cache.xml` file:
----
<?xml version="1.0" encoding="UTF-8"?>
<cache xmlns="http://geode.apache.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
<region name="Parent" refid="REPLICATE">
<region name="Child" refid="REPLICATE"/>
@@ -264,6 +264,8 @@ The second is an anonymous inner bean definition.
[source,xml]
----
<bean id="myListener" class="org.example.app.geode.cache.SimpleCacheListener"/>
<gfe:replicated-region id="regionWithListeners">
<gfe:cache-listener>
<!-- nested CacheListener bean reference -->
@@ -271,8 +273,6 @@ The second is an anonymous inner bean definition.
<!-- nested CacheListener bean definition -->
<bean class="org.example.app.geode.cache.AnotherSimpleCacheListener"/>
</gfe:cache-listener>
<bean id="myListener" class="org.example.app.geode.cache.SimpleCacheListener"/>
</gfe:replicated-region>
----
@@ -525,9 +525,9 @@ Consider the following native {data-store-name} `cache.xml` configuration file:
----
<?xml version="1.0" encoding="UTF-8"?>
<cache xmlns="http://geode.apache.org/schema/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://geode.apache.org/schema/cache http://geode.apache.org/schema/cache/cache-1.0.xsd"
version="1.0">
<region name="Customers" refid="REPLICATE">
<region name="Accounts" refid="REPLICATE">
@@ -558,14 +558,15 @@ not uncommon for a developer to define beans for some or all of these Regions in
meta-data as follows:
[source,xml]
[subs="verbatim,attributes"]
----
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:gfe="{spring-data-schema-namespace}"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/geode http://www.springframework.org/schema/gemfire/spring-geode.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
{spring-data-schema-namespace} {spring-data-schema-location}
">
<gfe:cache cache-xml-location="classpath:cache.xml"/>

View File

@@ -14,13 +14,15 @@ Data namespace, as the following example shows:
.Bootstrap Spring Data for {data-store-name} Repositories in XML
====
[source,xml]
[subs="verbatim,attributes"]
----
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe-data="http://www.springframework.org/schema/data/gemfire"
xmlns:gfe-data="{spring-data-access-schema-namespace}"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire.xsd>
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
{spring-data-access-schema-namespace} {spring-data-access-schema-location}
">
<gfe-data:repositories base-package="com.example.acme.repository"/>
@@ -311,6 +313,7 @@ public interface CustomerRepository extends GemfireRepository<Customer, Long> {
@Import("org.example.app.domain.Customer")
@Query("<TRACE> <HINT 'ReputationIdx'> SELECT DISTINCT * FROM /Customers c WHERE c.reputation > $1 ORDER BY c.reputation DESC LIMIT 5")
List<Customer> findDistinctCustomersByReputationGreaterThanOrderByReputationDesc(Integer reputation);
}
----
====