big gulp of Gradle functionality added (using Spring Data Redis as a template)
13
docs/src/reference/docbkx/appendix/appendix-schema.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<appendix xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="appendix-schema" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>Spring GemFire Integration Schema</title>
|
||||
|
||||
<para>Spring GemFire Schema</para>
|
||||
<programlisting language="xml"><xi:include href="../../../../../src/main/resources/org/springframework/data/gemfire/config/spring-gemfire-1.0.xsd" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:fallback>
|
||||
<para><emphasis>FIXME: SGF SCHEMA LOCATION/NAME CHANGED</emphasis></para>
|
||||
</xi:fallback>
|
||||
</xi:include>
|
||||
</programlisting>
|
||||
|
||||
</appendix>
|
||||
67
docs/src/reference/docbkx/index.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<book xmlns="http://docbook.org/ns/docbook" version="5.0"
|
||||
xml:id="spring-gemfire-reference"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<bookinfo>
|
||||
<title>Spring Gemfire Integration Reference Guide</title>
|
||||
<releaseinfo>@version@</releaseinfo>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Costin</firstname>
|
||||
<surname>Leau</surname>
|
||||
<affiliation>SpringSource, a division of VMware</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
|
||||
|
||||
<legalnotice>
|
||||
<para>Copies of this document may be made for your own use and for
|
||||
distribution to others, provided that you do not charge any fee for such
|
||||
copies and further provided that each copy contains this Copyright
|
||||
Notice, whether distributed in print or electronically.</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<toc />
|
||||
|
||||
<xi:include href="preface.xml"/>
|
||||
|
||||
<part id="introduction">
|
||||
<title>Introduction</title>
|
||||
|
||||
<xi:include href="introduction/introduction.xml"/>
|
||||
|
||||
</part>
|
||||
<part id="reference">
|
||||
<title>Reference Documentation</title>
|
||||
|
||||
<xi:include href="reference/introduction.xml"/>
|
||||
<xi:include href="reference/bootstrap.xml"/>
|
||||
<xi:include href="reference/data.xml"/>
|
||||
<xi:include href="reference/serialization.xml"/>
|
||||
<xi:include href="reference/samples.xml"/>
|
||||
<!--
|
||||
<xi:include href="reference/test.xml"/>
|
||||
-->
|
||||
</part>
|
||||
<part id="resources">
|
||||
<title>Other Resources</title>
|
||||
<partintro>
|
||||
<para>
|
||||
In addition to this reference documentation, there are a number of
|
||||
other resources that may help you learn how to use GemFire and Spring framework.
|
||||
These additional, third-party resources are enumerated in this section.
|
||||
</para>
|
||||
</partintro>
|
||||
<xi:include href="links.xml"/>
|
||||
<!--
|
||||
<xi:include href="bibliography.xml"/>
|
||||
-->
|
||||
</part>
|
||||
<part id="appendices">
|
||||
<title>Appendices</title>
|
||||
<xi:include href="appendix/appendix-schema.xml"/>
|
||||
</part>
|
||||
</book>
|
||||
10
docs/src/reference/docbkx/introduction/introduction.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<partintro xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<para>
|
||||
<para>This document is the reference guide for Spring GemFire project (SGF). It explains the relationship
|
||||
between Spring framework and GemFire Enterprise Fabric (GEF) 6.0.x, defines the basic concepts and semantics of the integration
|
||||
and how these can be used effectively.
|
||||
</para>
|
||||
</para>
|
||||
</partintro>
|
||||
8
docs/src/reference/docbkx/introduction/requirements.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<chapter xml:id="requirements" xmlns="http://docbook.org/ns/docbook" version="5.0">
|
||||
<title>Requirements</title>
|
||||
|
||||
<para>Spring GemFire integration requires JDK level 5.0 and above, Spring
|
||||
<ulink url="http://www.springsource.org/about">Framework</ulink> 3 and
|
||||
<ulink url="http://www.gemstone.com/products/gemfire">GemFire</ulink> 6 and above.
|
||||
</para>
|
||||
</chapter>
|
||||
12
docs/src/reference/docbkx/links.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="links">
|
||||
<title>Useful Links</title>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><emphasis>Spring GemFire Integration Home Page</emphasis> - <ulink url="http://www.springframework.org/spring-gemfire/">here</ulink></listitem>
|
||||
<listitem><emphasis>SpringSource blog</emphasis> - <ulink url="http://blog.springsource.com/">here</ulink></listitem>
|
||||
<listitem><emphasis>GemFire Community</emphasis> - <ulink url="http://community.gemstone.com/display/gemfire/GemFire+Enterprise">here</ulink></listitem>
|
||||
|
||||
</itemizedlist>
|
||||
</chapter>
|
||||
19
docs/src/reference/docbkx/preface.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<preface xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="preface">
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
Spring GemFire Integration focuses on integrating Spring Framework's powerful, non-invasive programming model
|
||||
and concepts with Gemstone's GemFire Enterprise Fabric, providing easier configuration, use and high-level abstractions.
|
||||
This document assumes the reader already has a basic familiarity with the Spring Framework and GemFire concepts
|
||||
and APIs.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
While every effort has been made to ensure that this documentation is comprehensive and there are no errors,
|
||||
nevertheless some topics might require more explanation and some typos might have crept in. If you do spot any
|
||||
mistakes or even more serious errors and you can spare a few cycles during lunch, please do bring the error
|
||||
to the attention of the Spring GemFire Integration team by raising an
|
||||
<ulink url="http://jira.springframework.org">issue</ulink>. Thank you.
|
||||
</para>
|
||||
|
||||
</preface>
|
||||
726
docs/src/reference/docbkx/reference/bootstrap.xml
Normal file
@@ -0,0 +1,726 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="bootstrap">
|
||||
<title>Bootstrapping GemFire through the Spring container</title>
|
||||
|
||||
<para>One of the first tasks when using GemFire and Spring is to configure
|
||||
the data grid through the IoC container. While this is <ulink
|
||||
url="http://community.gemstone.com/display/gemfire/Integrating+GemFire+with+the+Spring+IoC+Container">possible</ulink>
|
||||
out of the box, the configuration tends to be verbose and only address basic
|
||||
cases. To address this problem, the Spring GemFire project provides several
|
||||
classes that enable the configuration of distributed caches or regions to
|
||||
support a variety of scenarios with minimal effort.</para>
|
||||
|
||||
<section id="bootstrap:namespace">
|
||||
<title>Using the Spring GemFire Namespace</title>
|
||||
|
||||
<para>To simplify configuration, SGF provides a dedicated namespace for most of its components. However, one can opt to configure the beans
|
||||
directly through the usual <bean> definition. For more information about XML Schema-based configuration in Spring, see
|
||||
<ulink url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/xsd-config.html">this</ulink> appendix in the
|
||||
Spring Framework reference documentation.</para>
|
||||
|
||||
<para>To use the SGF namespace, one just needs to import it inside the configuration:</para>
|
||||
|
||||
<programlistingco>
|
||||
<areaspec>
|
||||
<area id="gfe#ns#prefix" coords="4 11"/>
|
||||
<area id="gfe#ns#uri" coords="4 58"/>
|
||||
<area id="gfe#ns#uri#loc" coords="7 119"/>
|
||||
<area id="gfe#ns#example" coords="10 9"/>
|
||||
</areaspec>
|
||||
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
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">
|
||||
<bean id ... >
|
||||
|
||||
<gfe:cache ...>
|
||||
|
||||
</beans>]]></programlisting>
|
||||
|
||||
<calloutlist>
|
||||
<callout arearefs="gfe#ns#prefix">
|
||||
<para>Spring GemFire namespace prefix. Any name can do but through out the reference documentation, the <literal>gfe</literal> will be used.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#ns#uri">
|
||||
<para>The namespace URI.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#ns#uri#loc">
|
||||
<para>The namespace URI location. Note that even though the location points to an external address (which exists and is valid), Spring will resolve
|
||||
the schema locally as it is included in the Spring GemFire library.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#ns#example">
|
||||
<para>Declaration example for the GemFire namespace. Notice the prefix usage.</para>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
</programlistingco>
|
||||
|
||||
<para>Once declared, the namespace elements can be declared simply by appending the aforementioned prefix. Note that is possible to change the default namespace,
|
||||
for example from <literal><beans></literal> to <literal><gfe></literal>. This is useful for configuration composed mainly of GemFire components as
|
||||
it avoids declaring the prefix. To achieve this, simply swap the namespace prefix declaration above:</para>
|
||||
|
||||
<programlistingco>
|
||||
<areaspec>
|
||||
<area id="gfe#default-ns#prefix" coords="2 64"/>
|
||||
<area id="gfe#default-ns#beans-prefix" coords="3 64"/>
|
||||
<area id="gfe#default-ns#beans-example" coords="9 64"/>
|
||||
<area id="gfe#default-ns#gfe-example" coords="11 64"/>
|
||||
</areaspec>
|
||||
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
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">
|
||||
|
||||
<beans:bean id ... >
|
||||
|
||||
<cache ...>
|
||||
|
||||
</beans>]]></programlisting>
|
||||
|
||||
<calloutlist>
|
||||
<callout arearefs="gfe#default-ns#prefix">
|
||||
<para>The default namespace declaration for this XML file points to the Spring GemFire namespace.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#default-ns#beans-prefix">
|
||||
<para>The beans namespace prefix declaration.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#default-ns#beans-example">
|
||||
<para>Bean declaration using the <literal><beans></literal> namespace. Notice the prefix.</para>
|
||||
</callout>
|
||||
<callout arearefs="gfe#default-ns#gfe-example">
|
||||
<para>Bean declaration using the <literal><gfe></literal> namespace. Notice the lack of prefix (as the default namespace is used).</para>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
</programlistingco>
|
||||
|
||||
<para>For the remainder of this doc, to improve readability, the XML examples will simply refer to the <literal><gfe></literal> namespace
|
||||
without the namespace declaration, where possible.</para>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:cache">
|
||||
<title>Configuring the GemFire
|
||||
<interfacename>Cache</interfacename></title>
|
||||
|
||||
<para>In order to use the GemFire Fabric, one needs to either create a new
|
||||
<interfacename>Cache</interfacename> or connect to an existing one. As in
|
||||
the current version of GemFire, there can be only one opened cache per VM
|
||||
(or classloader to be technically correct). In most cases the cache is
|
||||
created once and then all other consumers connect to it.</para>
|
||||
|
||||
<para>In its simplest form, a cache can be defined in one line:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:cache />]]></programlisting>
|
||||
|
||||
<para>The declaration above declares a bean(<literal>CacheFactoryBean</literal>)
|
||||
for the GemFire Cache, named <literal>gemfire-cache</literal>. All the other SGF components use this
|
||||
naming convention if no name is specified, allowing for very concise configurations. The definition above will try to connect to
|
||||
an existing cache and, in case one does not exist, create it. Since no
|
||||
additional properties were specified the created cache uses the default
|
||||
cache configuration.Especially in environments with opened caches, this basic
|
||||
configuration can go a long way.</para>
|
||||
|
||||
<para>For scenarios where the cache needs to be
|
||||
configured, the user can pass in a reference the GemFire configuration
|
||||
file:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:cache id="cache-with-xml" cache-xml-location="classpath:cache.xml"/>]]></programlisting>
|
||||
|
||||
<para>In this example, if the cache needs to be created, it will use the
|
||||
file named <literal>cache.xml</literal> located in the classpath root.
|
||||
Only if the cache is created will the configuration file be used.</para>
|
||||
|
||||
<note>
|
||||
<para>Note that the configuration makes use of Spring's <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/resources.html"><interfacename>Resource</interfacename></ulink>
|
||||
abstraction to locate the file. This allows various search patterns to
|
||||
be used, depending on the running environment or the prefix specified
|
||||
(if any) by the value.</para>
|
||||
</note>
|
||||
<para>
|
||||
In addition to referencing an external configuration file one can
|
||||
specify GemFire settings directly through Java
|
||||
<classname>Properties</classname>. This can be quite handy when just a few
|
||||
settings need to be changed.</para>
|
||||
|
||||
<para>To setup properties one can either use the <literal>properties</literal> element inside the <literal>util</literal> namespace
|
||||
to declare or load properties files (the latter is recommended for externalizing environment specific settings outside the application
|
||||
configuration):</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
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">
|
||||
|
||||
<gfe:cache id="cache-with-xml" cache-xml-location="classpath:cache.xml" properties-ref="props"/>
|
||||
|
||||
<util:properties id="props" location="classpath:/deployment/env.properties"/>
|
||||
</beans>]]></programlisting>
|
||||
|
||||
<para>Or can use fallback to a <emphasis>raw</emphasis> <literal><beans></literal> declaration:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="cache-with-props" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
<property name="properties">
|
||||
<props>
|
||||
<prop key="bind-address">127.0.0.1</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>In this last example, the SGF classes are declared and configured directly without relying on the namespace. As one can tell,
|
||||
this approach is a generic one, exposing more of the backing infrastructure.</para>
|
||||
|
||||
<para>It is worth pointing out again, that the cache settings apply only
|
||||
if the cache needs to be created, there is no opened cache in existence
|
||||
otherwise the existing cache will be used and the configuration will
|
||||
simply be discarded.</para>
|
||||
|
||||
<section id="bootstrap:cache:server">
|
||||
<title>Configuring a GemFire <literal>CacheServer</literal></title>
|
||||
|
||||
<para>In Spring GemFire 1.1 dedicated support for configuring a
|
||||
<ulink url="http://www.gemstone.com/docs/6.5.1/product/docs/japi/com/gemstone/gemfire/cache/server/package-summary.html">CacheServer</ulink> was added through
|
||||
the <literal>org.springframework.data.gemfire.server</literal> package allowing complete configuration through the Spring container:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.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
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<gfe:cache />
|
||||
|
||||
<!-- Advanced example depicting various cache server configuration options -->
|
||||
<gfe:cache-server id="advanced-config" auto-startup="true"
|
||||
bind-address="localhost" port="${gfe.port.6}" host-name-for-clients="localhost"
|
||||
load-poll-interval="2000" max-connections="22" max-threads="16"
|
||||
max-message-count="1000" max-time-between-pings="30000"
|
||||
groups="test-server">
|
||||
|
||||
<gfe:subscription-config eviction-type="ENTRY" capacity="1000" disk-store="file://${java.io.tmpdir}"/>
|
||||
</gfe:cache-server>
|
||||
|
||||
<context:property-placeholder location="classpath:port.properties" />
|
||||
</beans>]]></programlisting>
|
||||
|
||||
<para>The configuration above shows the dedicated namespace support (through the <literal>cache-server</literal> element) and the pleothera of options available. Note that rather
|
||||
then just hard-coding the port, this config uses Spring <literal><ulink url="http://static.springsource.org/spring/docs/3.0.x/reference/xsd-config.html">util</ulink></literal> namespace
|
||||
to read it from a properties file and then replace it at runtime allowing administrators to change it without having to touch the main application config. Through Spring's property placeholder
|
||||
<ulink url="http://static.springsource.org/spring/docs/3.0.x/reference/beans.html#beans-factory-placeholderconfigurer">support</ulink>,
|
||||
<ulink url="http://static.springsource.org/spring/docs/3.0.x/reference/expressions.html">SpEL</ulink> and the <ulink url="http://blog.springsource.com/2011/06/09/spring-framework-3-1-m2-released/">environment abstraction</ulink> one
|
||||
can externalize environment specific properties from the main code base easing the deployment across multiple machines.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region">
|
||||
<title>Configuring a GemFire <interfacename>Region</interfacename></title>
|
||||
|
||||
<para>Once the <interfacename>Cache</interfacename> is configured, one
|
||||
needs to configure one or more <interfacename>Region</interfacename>s to
|
||||
interact with the data fabric. SGF allows various region types to be configured and created directly from Spring or
|
||||
in case they are created directly in GemFire, retrieved as such.</para>
|
||||
|
||||
<para>For more information about the various region types and their capabilities as well as configuration options, please
|
||||
refer to the GemFire Developer's <ulink url="http://www.gemstone.com/documentation">Guide</ulink> and community
|
||||
<ulink url="http://community.gemstone.com/display/gemfire/GemFire+Enterprise">site</ulink>.</para>
|
||||
|
||||
<section id="bootstrap:region:lookup">
|
||||
<title>Using an externaly configured <interfacename>Region</interfacename></title>
|
||||
|
||||
<para>For consuming but not creating <interfacename>Region</interfacename>s (for example in case,
|
||||
the regions are already configured through GemFire native configuration, the <literal>cache.xml</literal>),
|
||||
one can use the <literal>lookup-region</literal> element. Simply declare the target region name the <literal>
|
||||
name</literal> attribute; for example to declare a bean definition, named <literal>region-bean</literal>
|
||||
for an existing region named <literal>orders</literal> one can use the following definition:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:lookup-region id="region-bean" name="orders"/>]]></programlisting>
|
||||
|
||||
<para>If the <literal>name</literal> is not specified, the bean name will be used automatically. The example above
|
||||
becomes:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<!-- lookup for a region called 'orders' -->
|
||||
<gfe:lookup-region id="orders"/>]]></programlisting>
|
||||
|
||||
<note><para>If the region does not exist, an initialization exception will be thrown. For configuring new GemFire regions
|
||||
proceed to the sections below for replicated, partitioned, client or advanced region configuration.</para></note>
|
||||
|
||||
<para>Note that in the previous examples, since no cache name was defined, the default SGF naming convention (<literal>gemfire-cache</literal>)
|
||||
was used. If that is not an option, one can point to the cache bean through the <literal>cache-ref</literal> attribute:
|
||||
</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:cache id="cache"/>
|
||||
|
||||
<gfe:lookup-region id="region-bean" name="orders" cache-ref="cache"/>]]></programlisting>
|
||||
|
||||
<para>The <literal>lookup-region</literal> provides a simple way of retrieving existing, pre-configured regions without exposing
|
||||
the region semantics or setup infrastructure.</para>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:replicate">
|
||||
<title>Replicated Region</title>
|
||||
|
||||
<para>One of the common region types supported by GemFire is <emphasis>replicated region</emphasis> or <emphasis>replica</emphasis>. In short:</para>
|
||||
|
||||
<note><title>What is a replica?</title>
|
||||
When a region is configured to be a replicated region, every member that hosts that region stores a copy of the contents of the region locally.
|
||||
Any update to a replicated region is distributed to all copies of the region. [...] When a replica is created, it goes through an initialization stage
|
||||
in which it discovers other replicas and automatically copies all the entries. While one replica is initializing you can still continue to use the other replicas.
|
||||
</note>
|
||||
|
||||
<para>SGF offers a dedicated element for creating replicas in the form of <literal>replicated-region</literal> element. A minimal declaration looks as follows
|
||||
(again, the example will not setup the cache wiring, relying on the SGF namespace naming conventions):</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:replicated-region id="simple-replica" />]]></programlisting>
|
||||
|
||||
<para>Here, a replicated region is created (if one doesn't exist already). The name of the region is the same as the bean name (<literal>simple-replica</literal>) and
|
||||
the bean assumes the existence of a GemFire cache named <literal>gemfire-cache</literal>.</para>
|
||||
|
||||
<para>When setting a region, it's fairly common to associate various <interfacename>CacheLoader</interfacename>s, <interfacename>CacheListener</interfacename>s and
|
||||
<interfacename>CacheWriter</interfacename>s with it. These components can be either referrenced or declared inlined by the region declaration.</para>
|
||||
|
||||
<note><para>
|
||||
Following the GemFire recommandations, the namespace allows for each region created multiple listeners but only one
|
||||
cache writer and cache loader. This restriction can be relaxed, for advanced usages by using the <literal>beans</literal> declaration (see the next section).
|
||||
</para></note>
|
||||
|
||||
<para>Below is an example, showing both styles:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:replicated-region id="mixed">
|
||||
<gfe:cache-listener>
|
||||
<!-- nested cache listener reference -->
|
||||
<ref bean="c-listener"/>
|
||||
<!-- nested cache listener declaration -->
|
||||
<bean class="some.pkg.SimpleCacheListener"/>
|
||||
</gfe:cache-listener>
|
||||
<!-- loader reference -->
|
||||
<gfe:cache-loader ref="c-loader"/>
|
||||
<!-- writer reference -->
|
||||
<gfe:cache-writer ref="c-writer"/>
|
||||
</gfe:replicated-region>]]></programlisting>
|
||||
|
||||
<warning><para>Using <literal>ref</literal> and a nested declaration on <literal>cache-listener</literal>, <literal>cache-loader</literal> or <literal>cache-writer</literal>
|
||||
is illegal. The two options are mutually exclusive and using them at the same time, on the same element will throw an exception.</para></warning>
|
||||
|
||||
<section id="bootstrap:region:replicate:options">
|
||||
<title><literal>replicated-region</literal> Options</title>
|
||||
|
||||
<para>The following table offers a quick overview of the most important configuration options names, possible values and short descriptions for each of settings supported by the
|
||||
<literal>replicated-region</literal> element. Please see the storage and eviction section for the relevant configuration.</para>
|
||||
|
||||
<table id="bootstrap:region:replicate:attrs:table" pgwide="1" align="center">
|
||||
<title><![CDATA[replicated-region]]> options</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colname="c1"/>
|
||||
<colspec colname="c2"/>
|
||||
<colspec colname="c3"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry spanname="values">Values</entry>
|
||||
<entry align="center">Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>id</entry>
|
||||
<entry spanname="values"><emphasis>any valid bean name</emphasis></entry>
|
||||
<entry>The id of the region bean definition.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry spanname="values"><emphasis>any valid region name</emphasis></entry>
|
||||
<entry>The name of the region definition. If no specified, it will have the value of the id attribute (that is, the bean name).</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-ref</entry>
|
||||
<entry spanname="values"><emphasis>GemFire cache bean name</emphasis></entry>
|
||||
<entry>The name of the bean defining the GemFire cache (by default 'gemfire-cache').</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-listener</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheListener</interfacename>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-loader</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheLoader</interfacename>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-writer</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheWriter</interfacename>.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:partition">
|
||||
<title>Partition(ed) Region</title>
|
||||
|
||||
<para>Another region type supported out of the box by the SGF namespace, is the partitioned region. To quote again the GemFire docs:</para>
|
||||
|
||||
<note><title>What is a partition?</title>
|
||||
<para>A partitioned region is a region where data is divided between peer servers hosting the region so that each peer stores a subset of the data.
|
||||
When using a partitioned region, applications are presented with a logical view of the region that looks like a single map containing all of the data in the region.
|
||||
Reads or writes to this map are transparently routed to the peer that hosts the entry that is the target of the operation. [...]
|
||||
GemFire divides the domain of hashcodes into buckets. Each bucket is assigned to a specific peer, but may be relocated at any time to another peer in
|
||||
order to improve the utilization of resources across the cluster.</para></note>
|
||||
|
||||
<para>A partition can be created by SGF through the <literal>partitioned-region</literal> element. Its configuration options are similar to that of the
|
||||
<literal>replicated-region</literal> plus the partion specific features such as the number of redundant copies, total maximum memory, number of buckets, partition
|
||||
resolver and so on.
|
||||
Below is a quick example on setting up a partition region with 2 redundant copies:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<!-- bean definition named 'distributed-partition' backed by a region named 'redundant' with 2 copies
|
||||
and a nested resolver declaration -->
|
||||
<gfe:partitioned-region id="distributed-partition" copies="2" total-buckets="4" name="redundant">
|
||||
<gfe:partition-resolver>
|
||||
<bean class="some.pkg.SimplePartitionResolver"/>
|
||||
</gfe:partition-resolver>
|
||||
</gfe:partitioned-region>]]></programlisting>
|
||||
|
||||
<section id="bootstrap:region:partition:options">
|
||||
<title><literal>partitioned-region</literal> Options</title>
|
||||
|
||||
<para>The following table offers a quick overview of the most important configuration options names, possible values and short descriptions for each of settings supported by the
|
||||
partition element. Please see the storage and eviction section for the relevant configuration.</para>
|
||||
|
||||
<table id="bootstrap:region:partition:attrs:table" pgwide="1" align="center">
|
||||
<title><![CDATA[partitioned-region]]> options</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colname="c1"/>
|
||||
<colspec colname="c2"/>
|
||||
<colspec colname="c3"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry spanname="values">Values</entry>
|
||||
<entry align="center">Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>id</entry>
|
||||
<entry spanname="values"><emphasis>any valid bean name</emphasis></entry>
|
||||
<entry>The id of the region bean definition.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>name</entry>
|
||||
<entry spanname="values"><emphasis>any valid region name</emphasis></entry>
|
||||
<entry>The name of the region definition. If no specified, it will have the value of the id attribute (that is, the bean name).</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-ref</entry>
|
||||
<entry spanname="values"><emphasis>GemFire cache bean name</emphasis></entry>
|
||||
<entry>The name of the bean defining the GemFire cache (by default 'gemfire-cache').</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>cache-listener</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheListener</interfacename>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-loader</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheLoader</interfacename>.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>cache-writer</entry>
|
||||
<entry spanname="values"><emphasis>valid bean name or definition</emphasis></entry>
|
||||
<entry>The name or nested bean declaration of a GemFire <interfacename>CacheWriter</interfacename>.</entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry>partition-resolver</entry>
|
||||
<entry spanname="values"><emphasis>bean name</emphasis></entry>
|
||||
<entry>The name of the partitioned resolver used by this region, for custom partitioning.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>copies</entry>
|
||||
<entry spanname="values">0..4</entry>
|
||||
<entry>The number of copies for each partition for high-availability. By default, no copies are created meaning there is no
|
||||
redundancy. Each copy provides extra backup at the expense of extra storages.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>colocated-with</entry>
|
||||
<entry spanname="values"><emphasis>valid region name</emphasis></entry>
|
||||
<entry>The name of the partitioned region with which this newly created partitioned region is colocated.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>local-max-memory</entry>
|
||||
<entry spanname="values"><emphasis>positive integer</emphasis></entry>
|
||||
<entry>The maximum amount of memory, in megabytes, to be used by the region in <emphasis>this</emphasis> process.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>total-max-memory</entry>
|
||||
<entry spanname="values"><emphasis>any integer value</emphasis></entry>
|
||||
<entry>The maximum amount of memory, in megabytes, to be used by the region in <emphasis>all</emphasis> processes.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>recovery-delay</entry>
|
||||
<entry spanname="values"><emphasis>any long value</emphasis></entry>
|
||||
<entry>The delay in milliseconds that existing members will wait before satisfying redundancy after another member crashes.
|
||||
-1 (the default) indicates that redundancy will not be recovered after a failure.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>startup-recovery-delay</entry>
|
||||
<entry spanname="values"><emphasis>any long value</emphasis></entry>
|
||||
<entry>The delay in milliseconds that new members will wait before satisfying redundancy. -1 indicates that adding new members
|
||||
will not trigger redundancy recovery. The default is to recover redundancy immediately when a new member is added.</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:client">
|
||||
<title>Client Region</title>
|
||||
|
||||
<para>GemFire supports various deployment topologies for managing and distributing data. The topic is outside the scope of this documentation however to quickly recap, they
|
||||
can be categoried in short in: peer-to-peer (p2p), client-server (or super-peer cache network) and wide area cache network (or WAN). In the last two scenarios, it is common
|
||||
to declare <emphasis>client</emphasis> regions which connect to a backing cache server (or super peer). SGF offers dedicated support for such configuration through the
|
||||
<literal>client-region</literal> and <literal>pool</literal> elements.
|
||||
As the name imply, the former defines a client region while the latter connection pools to be used/shared by the various client regions.</para>
|
||||
|
||||
<para>Below is a usual configuration for a client region:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<!-- client region declaration -->
|
||||
<gfe:client-region id="complex" pool-name="gemfire-pool">
|
||||
<gfe:cache-listener ref="c-listener"/>
|
||||
</gfe:client-region>
|
||||
|
||||
<bean id="c-listener" class="some.pkg.SimpleCacheListener"/>
|
||||
|
||||
<!-- pool declaration -->
|
||||
<gfe:pool id="gemfire-pool" subscription-enabled="false">
|
||||
<gfe:locator host="localhost" port="40403"/>
|
||||
</gfe:pool>]]></programlisting>
|
||||
|
||||
<para>Just as the other region types, <literal>client-region</literal> allows defining <interfacename>CacheListener</interfacename>s. It also relies on the same naming conventions
|
||||
in case the region name or the cache are not set explicitely. However, it also requires a connection <literal>pool</literal> to be specified for connecting to the server. Each client
|
||||
can have its own pool or they can share the same one.</para>
|
||||
|
||||
<para>For a full list of options to set on the client and especially on the pool, please refer to the SGF schema (<xref linkend="appendix-schema"/>) and the GemFire documentation.</para>
|
||||
|
||||
<section id="bootstrap:region:client:interests">
|
||||
<title>Client Interests</title>
|
||||
|
||||
<para>To minimize network traffic, each client can define its own 'interest', pointing out to GemFire, the data it actually needs. In SGF, interests can be defined for each client, both
|
||||
key-based and regular-expression-based types being supported; for example:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:client-region id="complex" pool-name="gemfire-pool">
|
||||
<gfe:key-interest durable="true" result-policy="KEYS">
|
||||
<bean id="key" class="java.lang.String"/>
|
||||
</gfe:key-interest>
|
||||
<gfe:regex-interest pattern=".*"/>
|
||||
</gfe:client-region>]]></programlisting>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:disk-storage">
|
||||
<title>Configurating Disk Storage</title>
|
||||
|
||||
<para>GemFire can use disk as a secondary storage for persisting regions or/and overflow (known as data pagination or eviction to disk). SGF allows such options to be configured
|
||||
directly from Spring through <literal>disk-store</literal> element available on both <literal>replicated-region</literal> and <literal>partitioned-region</literal> as well as
|
||||
<literal>client-region</literal>.
|
||||
A disk store defines how that particular region can use the disk and how much space it has available. Multiple directories can be defined in a disk store such as in our example below:
|
||||
</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:partitioned-region id="partition-data">
|
||||
<gfe:disk-store queue-size="50" auto-compact="true" max-oplog-size="10" synchronous-write="false" time-interval="9999">
|
||||
<gfe:disk-dir location="/mainbackup/partition" max-size="999"/>
|
||||
<gfe:disk-dir location="/backup2/partition" max-size="999"/>
|
||||
</gfe:disk-store>
|
||||
</gfe:replicated-region>]]></programlisting>
|
||||
|
||||
<para>In general, for maximum efficiency, it is recommended that each region that accesses the disk uses a disk store configuration.</para>
|
||||
|
||||
<para>
|
||||
For the full set of options and their meaning please refer to the <xref linkend="appendix-schema"/> and GemFire documentation.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:persistence">
|
||||
<title>Data Persistence</title>
|
||||
|
||||
<para>Both partitioned and replicated regions can be made persistent. That is:</para>
|
||||
|
||||
<note><title>What is region persistence?</title>
|
||||
<para>GemFire ensures that all the data you put into a region that is configured for persistence will be written to disk in a way that it can be
|
||||
recovered the next time you create the region. This allows data to be recovered after a machine or process failure or after an orderly shutdown and
|
||||
restart of GemFire.</para>
|
||||
</note>
|
||||
|
||||
<para>With SGF, to enable persistence, simply set to true the <literal>persistent</literal> attribute on <literal>replicated-region</literal>,
|
||||
<literal>partitioned-region</literal> or <literal>client-region</literal>:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:partitioned-region id="persitent-partition" persistent="true"/>]]></programlisting>
|
||||
|
||||
<important><para>Persistence for partitioned regions is supported from GemFire 6.5 onwards - configuring this option on a previous release will trigger
|
||||
an initialization exception.</para></important>
|
||||
|
||||
<para>When persisting regions, it is recommended to configure the storage through the <literal>disk-store</literal> element for maximum efficiency.</para>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:eviction">
|
||||
<title>Data Eviction and Overflowing</title>
|
||||
|
||||
<para>Based on various constraints, each region can have an eviction policy in place for <literal>evicting</literal> data from memory. Currently, in GemFire
|
||||
eviction applies on the least recently used entry (also known as <ulink url="http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used">LRU</ulink>).
|
||||
Evicted entries are either destroyed or paged to disk (also known as <emphasis>overflow</emphasis>).</para>
|
||||
|
||||
<para>SGF supports all eviction policies (entry count, memory and heap usage) for both <literal>partitioned-region</literal> and <literal>replicated-region</literal>
|
||||
as well as <literal>client-region</literal>, through the nested <literal>eviction</literal> element.
|
||||
For example, to configure a partition to overflow to disk if its size is more then 512 MB, one could use
|
||||
the following configuration:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<gfe:partitioned-region id="overflow-partition">
|
||||
<gfe:eviction type="MEMORY_SIZE" threshold="512" action="OVERFLOW_TO_DISK"/>
|
||||
</gfe:partitioned-region>]]></programlisting>
|
||||
|
||||
<important><para>Replicas cannot use a <literal>local destroy</literal> eviction since that would invalidate them. See the GemFire docs for more information.</para></important>
|
||||
|
||||
<para>When configuring regions for oveflow, it is recommended to configure the storage through the <literal>disk-store</literal> element for maximum efficiency.</para>
|
||||
|
||||
<para>For a detailed description of eviction policies, see the GemFire documentation (such as <ulink url="http://community.gemstone.com/display/gemfire/Data+Eviction">this</ulink>
|
||||
page).</para>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:beans:config">
|
||||
<title>Advanced Region Configuration</title>
|
||||
|
||||
<para>SGF namespaces allow short and easy configuration of the major GemFire regions and associated entities. However, there might be corner cases where the namespaces are not enough, where
|
||||
a certain combination or set of attributes needs to be used. For such situations, using directly the SGF <interfacename>FactoryBean</interfacename>s is a possible alternative as it gives
|
||||
access to the full set of options at the expense of conciseness.</para>
|
||||
|
||||
<para>As a warm up, below are some common configurations, declared through raw <literal>beans</literal> definitions.</para>
|
||||
|
||||
<para>A basic configuration looks as follows:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="basic" class="org.springframework.data.gemfire.RegionFactoryBean">
|
||||
<property name="cache">
|
||||
<bean class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
</property>
|
||||
<property name="name" value="basic"/>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>Notice how the GemFire cache definition has been nested into the declaring region definition. Let's add more regions
|
||||
and make the cache a top level bean.</para>
|
||||
<para>Since the region bean definition name is usually the same with that
|
||||
of the cache, the <literal>name</literal> property can be omitted (the
|
||||
bean name will be used automatically). Additionally by using the name the
|
||||
<literal><ulink
|
||||
url="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-p-namespace">p</ulink></literal>
|
||||
namespace, the configuration can be simplified even more:</para>
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<!-- shared cache across regions -->
|
||||
<bean id="cache" class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
|
||||
<!-- region named 'basic' -->
|
||||
<bean id="basic" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache"/>
|
||||
|
||||
<!-- region with a name different then the bean definition -->
|
||||
<bean id="root-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:name="default-region"/>
|
||||
</beans></programlisting>
|
||||
|
||||
<para>It is worth pointing out, that for the vast majority of cases
|
||||
configuring the cache loader, listener and writer through the Spring
|
||||
container is preferred since the same instances can be reused across
|
||||
multiple regions and additionally, the instances themselves can benefit
|
||||
from the container's rich feature set:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="cacheLogger" class="org.some.pkg.CacheLogger"/>
|
||||
<bean id="customized-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="cacheListeners">
|
||||
<array>
|
||||
<ref name="cacheLogger"/>
|
||||
<bean class="org.some.other.pkg.SysoutLogger"/>
|
||||
</array>
|
||||
</property>
|
||||
<property name="cacheLoader"><bean class="org.some.pkg.CacheLoad"/></property>
|
||||
<property name="cacheWriter"><bean class="org.some.pkg.CacheWrite"/></property>
|
||||
</bean>
|
||||
|
||||
<bean id="local-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="cacheListeners" ref="cacheLogger"/>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>For scenarios where a <emphasis>CacheServer</emphasis> is used and
|
||||
<emphasis>clients</emphasis> need to be configured and the namespace is not an option, SGF offers a
|
||||
dedicated configuration class named:
|
||||
<classname>ClientRegionFactoryBean</classname>. This allows client
|
||||
<emphasis>interests</emphasis> to be registered in both key and regex
|
||||
form through <classname>Interest</classname> and
|
||||
<classname>RegexInterest</classname> classes in the
|
||||
<literal>org.springframework.data.gemfire.client</literal> package:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="interested-client" class="org.springframework.data.gemfire.client.ClientRegionFactoryBean" p:cache-ref="cache" p:name="client-region">
|
||||
<property name="interests">
|
||||
<array>
|
||||
<!-- key-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.client.Interest" p:key="Vlaicu" p:policy="NONE"/>
|
||||
<!-- regex-based interest -->
|
||||
<bean class="org.springframework.data.gemfire.client.RegexInterest" p:key=".*" p:policy="KEYS" p:durable="true"/>
|
||||
</array>
|
||||
</property>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>Users that need fine control over a region, can configure it in Spring by using the <literal>attributes</literal> property. To ease declarative configuration in Spring,
|
||||
SGF provides two <interfacename>FactoryBean</interfacename>s for creating <interfacename>RegionAttributes</interfacename> and <interfacename>PartitionAttributes</interfacename>,
|
||||
namely <classname>RegionAttributesFactory</classname> and <classname>PartitionAttributesFactory</classname>. See below an example of configuring a partitioned region through Spring
|
||||
XML:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<bean id="partitioned-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache">
|
||||
<property name="attributes">
|
||||
<bean class="org.springframework.data.gemfire.RegionAttributesFactory" p:initial-capacity="1024">
|
||||
<property name="partitionAttributes">
|
||||
<bean class="org.springframework.data.gemfire.PartitionAttributesFactory" p:redundant-copies="2" p:local-max-memory="512"/>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>]]></programlisting>
|
||||
|
||||
<para>By using the attribute factories above, one can reduce the size of the <literal>cache.xml</literal> or even eliminate it all together.</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="bootstrap:region:spring:config">
|
||||
<title>Advantages of using Spring over GemFire <literal>cache.xml</literal></title>
|
||||
|
||||
<para>With SGF, GemFire regions, pools and cache can be configured either through Spring or directly inside GemFire, native, <literal>cache.xml</literal> file. While both are valid
|
||||
approaches, it's worth pointing out that Spring's powerful DI container and AOP functionality makes it very easy to wire GemFire into an application. For example configuring a region
|
||||
cache loader, listener and writer through the Spring container is preferred since the same instances can be reused across multiple regions and additionally are either to configure
|
||||
due to the presence of the DI and eliminates the need of implementing GemFire's <interfacename>Declarable</interfacename> interface (see <xref linkend="apis:declarable"/> on chapter
|
||||
on how you can still use them yet benefit from Spring's DI container).</para>
|
||||
|
||||
<para>Whatever route one chooses to go, SGF supports both approaches allowing for easy migrate between them without forcing an upfront decision.</para>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
346
docs/src/reference/docbkx/reference/data.xml
Normal file
@@ -0,0 +1,346 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="apis">
|
||||
<title>Working with the GemFire APIs</title>
|
||||
|
||||
<para>Once the GemFire cache and regions have been configured they can
|
||||
injected and used inside application objects. This chapter describes the
|
||||
integration with Spring's transaction management functionality and
|
||||
<classname>DaoException</classname> hierarchy. It also covers support for
|
||||
dependency injection of GemFire managed objects.</para>
|
||||
|
||||
<section id="apis:exception-translation">
|
||||
<title>Exception translation</title>
|
||||
|
||||
<para>Using a new data access technology requires not just accommodating
|
||||
to a new API but also handling exceptions specific to that technology. To
|
||||
accommodate this case, Spring Framework provides a technology agnostic,
|
||||
consistent exception <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/dao.html#dao-exceptions">hierarchy</ulink>
|
||||
that abstracts one from proprietary (and usually checked) exceptions to a
|
||||
set of focused runtime exceptions. As mentioned in the Spring Framework
|
||||
documentation, <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/orm.html#orm-exception-translation">exception
|
||||
translation</ulink> can be applied transparently to your data access
|
||||
objects through the use of the <literal>@Repository</literal> annotation
|
||||
and AOP by defining a PersistenceExceptionTranslationPostProcessor bean.
|
||||
The same exception translation functionality is enabled when using Gemfire
|
||||
as long as at least a <classname>CacheFactoryBean</classname> is declared.
|
||||
The <interfacename>Cache</interfacename> factory acts as an exception
|
||||
translator which is automatically detected by the Spring infrastructure
|
||||
and used accordingly.</para>
|
||||
</section>
|
||||
|
||||
<section id="apis:template">
|
||||
<title><classname>GemfireTemplate</classname></title>
|
||||
|
||||
<para>As with many other high-level abstractions provided by the Spring
|
||||
Framework and related projects, Spring GemFire provides a
|
||||
<emphasis>template</emphasis> that plays a central role when working with
|
||||
the GemFire API. The class provides several <emphasis>one-liner</emphasis>
|
||||
methods, for popular operations but also the ability to
|
||||
<emphasis>execute</emphasis> code against the native GemFire API without
|
||||
having to deal with exceptions for example through the
|
||||
<interfacename>GemfireCallback</interfacename>.</para>
|
||||
|
||||
<para>The template class requires a GemFire
|
||||
<interfacename>Region</interfacename> instance and once configured is
|
||||
thread-safe and should be reused across multiple classes:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="gemfireTemplate" class="org.springframework.data.gemfire.GemfireTemplate" p:region-ref="someRegion"/></programlisting>
|
||||
|
||||
<para>Once the template is configured, one can use it alongside
|
||||
<interfacename>GemfireCallback</interfacename> to work directly with the
|
||||
GemFire <interfacename>Region</interfacename>, without having to deal with
|
||||
checked exceptions, threading or resource management concerns:</para>
|
||||
|
||||
<programlisting language="java">template.execute(new GemfireCallback<Iterable<String>>() {
|
||||
public Iterable<String> doInGemfire(Region reg) throws GemFireCheckedException, GemFireException {
|
||||
// working against a Region of String
|
||||
Region<String, String> region = reg;
|
||||
|
||||
region.put("1", "one");
|
||||
region.put("3", "three");
|
||||
|
||||
return region.query("length < 5");
|
||||
}
|
||||
});</programlisting>
|
||||
|
||||
<para>For accessing the full power of the GemFire query language, one can use the <methodname>find</methodname> and <methodname>findUnique</methodname> which, as oppose to the
|
||||
<methodname>query</methodname> method, can execute queries inside across multiple regions, execute projections just to name a few features. <methodname>find</methodname> method should be
|
||||
used when the query selects multiple items (through <literal>SelectResults</literal>) and the latter, <methodname>findUnique</methodname>, as the name suggests when only one object is returned.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="apis:spring-cache-abstraction">
|
||||
<title>Support for Spring Cache Abstraction</title>
|
||||
|
||||
<para>Since 1.1, Spring GemFire provides an implementation for Spring 3.1
|
||||
<ulink url="http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/cache.html">cache abstraction</ulink> through the
|
||||
<literal>org.springframework.data.gemfire.support</literal> package. To use GemFire
|
||||
as a backing implementation, simply add <literal>GemfireCacheManager</literal> to your configuration:</para>
|
||||
|
||||
<programlisting language="xml"><![CDATA[<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:cache="http://www.springframework.org/schema/cache"
|
||||
xmlns:gfe="http://www.springframework.org/schema/gemfire"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
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">
|
||||
<!-- turn on declarative caching -->
|
||||
<cache:annotation-driven />
|
||||
|
||||
<gfe:cache id="gemfire-cache" />
|
||||
<!-- declare GemFire Cache Manager -->
|
||||
<bean id="cacheManager" class="org.springframework.data.gemfire.support.GemfireCacheManager" p:cache-ref="gemfire-cache">
|
||||
</beans>]]>
|
||||
|
||||
</programlisting>
|
||||
</section>
|
||||
|
||||
|
||||
<section id="apis:tx-mgmt">
|
||||
<title>Transaction Management</title>
|
||||
|
||||
<para>One of the most popular features of Spring Framework is <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html">transaction</ulink>
|
||||
management. If you are not familiar with it, we strongly recommend <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html#transaction-motivation">looking</ulink>
|
||||
into it as it offers a consistent programming model that works
|
||||
transparently across multiple APIs that can be configured either
|
||||
programmatically or declaratively (the most popular choice).</para>
|
||||
|
||||
<para>For GemFire, SGF provides a dedicated, per-cache, transaction
|
||||
manager that once declared, allows actions on the
|
||||
<interfacename>Region</interfacename>s to be grouped and executed
|
||||
atomically through Spring:</para>
|
||||
|
||||
<programlisting language="xml"><gfe:transaction-manager id="tx-manager" cache-ref="cache"/></programlisting>
|
||||
<note>The example above can be simplified even more by eliminating the <literal>cache-ref</literal> attribute if the GemFire cache is defined under the default
|
||||
name <literal>gemfire-cache</literal>. As with the other SGF namespace elements, if the cache name is not configured, the aforementioned naming convention will used.
|
||||
Additionally, the transaction manager name, if not specified is <literal>gemfire-transaction-manager</literal>.</note>
|
||||
|
||||
<para>or if you prefer <literal>bean</literal> declarations:</para>
|
||||
<programlisting language="xml"><bean id="tx-manager" class="org.springframework.data.gemfire.GemfireTransactionManager" p:cache-ref="cache"/></programlisting>
|
||||
|
||||
<para>Note that currently GemFire supports optimistic transactions with
|
||||
<emphasis>read committed</emphasis> isolation. Furthermore, to guarantee
|
||||
this isolation, developers should avoid making
|
||||
<emphasis>in-place</emphasis> changes, that is manually modifying the
|
||||
values present in the cache. To prevent this from happening, the
|
||||
transaction manager configured the cache to use <emphasis>copy on
|
||||
read</emphasis> semantics, meaning a clone of the actual value is created,
|
||||
each time a read is performed. This behaviour can be disabled if needed
|
||||
through the <literal>copyOnRead</literal> property. For more information
|
||||
on the semantics of the underlying GemFire transaction manager, see the
|
||||
GemFire <ulink
|
||||
url="http://www.gemstone.com/docs/6.0.1/product/docs/japi/com/gemstone/gemfire/cache/CacheTransactionManager.html">documentation</ulink>.</para>
|
||||
</section>
|
||||
|
||||
<section id="apis:declarable">
|
||||
<title>Wiring <interfacename>Declarable</interfacename> components</title>
|
||||
|
||||
<para>GemFire XML configuration (usually named
|
||||
<literal>cache.xml</literal> allows <emphasis>user</emphasis> objects to
|
||||
be declared as part of the fabric configuration. Usually these objects are
|
||||
<interfacename>CacheLoader</interfacename>s or other pluggable components
|
||||
into GemFire. Out of the box in GemFire, each such type declared through
|
||||
XML must implement the <interfacename>Declarable</interfacename> interface
|
||||
which allows arbitrary parameters to be passed to the declared class
|
||||
through a <classname>Properties</classname> instance.</para>
|
||||
|
||||
<para>In this section we describe how you can configure the pluggable
|
||||
components defined in <literal>cache.xml</literal> using Spring while
|
||||
keeping your Cache/Region configuration defined in
|
||||
<literal>cache.xml</literal> This allows your pluggable components to
|
||||
focus on the application logic and not the location or creation of
|
||||
DataSources or other collaboration object.</para>
|
||||
|
||||
<para>However, if you are starting on a green-field project, it is
|
||||
recommended that you configure Cache, Region, and other pluggable
|
||||
components directly in Spring. This avoids inheriting from the
|
||||
<interfacename>Declarable</interfacename> interface or the base class
|
||||
presented in this section. See the following sidebar for more information
|
||||
on this approach.</para>
|
||||
|
||||
<sidebar>
|
||||
<title>Eliminate <interfacename>Declarable</interfacename>
|
||||
components</title>
|
||||
|
||||
<para>One can configure custom types entirely inside through Spring as
|
||||
mentioned in <xref linkend="bootstrap:region" />. That way, one does not
|
||||
have to implement the <interfacename>Declarable</interfacename>
|
||||
interface and gets access to all the features of the Spring IoC
|
||||
container (including not just dependency injection but also life-cycle
|
||||
and instance management).</para>
|
||||
</sidebar>
|
||||
|
||||
<para>As an example of configuring a
|
||||
<interfacename>Declarable</interfacename> component using Spring, consider
|
||||
the following declaration (taken from the
|
||||
<interfacename>Declarable</interfacename> javadoc):</para>
|
||||
|
||||
<programlisting language="xml"><cache-loader>
|
||||
<class-name>com.company.app.DBLoader</class-name>
|
||||
<parameter name="URL">
|
||||
<string>jdbc://12.34.56.78/mydb</string>
|
||||
</parameter>
|
||||
</cache-loader></programlisting>
|
||||
|
||||
<para>To simplify the task of parsing, converting the parameters and
|
||||
initializing the object, SGF offers a base class
|
||||
(<classname>WiringDeclarableSupport</classname>) that allows GemFire user
|
||||
objects to be wired through a <emphasis>template</emphasis> bean
|
||||
definition or, in case that is missing perform autowiring through the
|
||||
Spring container. To take advantage of this feature, the user objects need
|
||||
to extend <classname>WiringDeclarableSupport</classname> which
|
||||
automatically locates the declaring
|
||||
<interfacename>BeanFactory</interfacename> and performs wiring as part of
|
||||
the initialization process.</para>
|
||||
|
||||
<sidebar>
|
||||
<title>Why is a base class needed?</title>
|
||||
|
||||
<para>In the current GemFire release there is no concept of an
|
||||
<emphasis>object factory</emphasis> and the types declared are
|
||||
instantiated and used as is - that is there are no other ways in which
|
||||
third parties can take care of the object creation outside GemFire.
|
||||
Support for this feature is planned for the up-coming GemFire release
|
||||
(6.5)</para>
|
||||
</sidebar>
|
||||
|
||||
<section id="apis:declarable:template-wiring">
|
||||
<title>Configuration using <emphasis>template</emphasis>
|
||||
definitions</title>
|
||||
|
||||
<para>When used <classname>WiringDeclarableSupport</classname> tries to
|
||||
first locate an existing bean definition and use that as wiring
|
||||
template. Unless specified, the component class name will be used as an
|
||||
implicit bean definition name. Let's see how our
|
||||
<classname>DBLoader</classname> declaration would look in that
|
||||
case:</para>
|
||||
|
||||
<programlisting language="java">public class DBLoader extends WiringDeclarableSupport implements CacheLoader {
|
||||
private DataSource dataSource;
|
||||
|
||||
public void setDataSource(DataSource ds){
|
||||
this.dataSource = ds;
|
||||
}
|
||||
|
||||
public Object load(LoaderHelper helper) { ... }
|
||||
}</programlisting>
|
||||
|
||||
<programlisting language="xml"><cache-loader>
|
||||
<class-name>com.company.app.DBLoader</class-name>
|
||||
<!-- no parameter is passed (use the bean implicit name
|
||||
that is the class name) -->
|
||||
</cache-loader></programlisting>
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="dataSource" ... />
|
||||
|
||||
<!-- template bean definition -->
|
||||
<bean id="com.company.app.DBLoader" abstract="true" p:dataSource-ref="dataSource"/>
|
||||
</beans></programlisting>
|
||||
|
||||
<para>In the scenario above, as no parameter was specified, a bean with
|
||||
id/name <literal>com.company.app.DBLoader</literal> was searched for.
|
||||
The found bean definition is used as a template for wiring the instance
|
||||
created by GemFire. For cases where the bean name uses a different
|
||||
convention, one can pass in the <literal>bean-name</literal> parameter
|
||||
in the GemFire configuration:</para>
|
||||
|
||||
<programlisting language="xml"><cache-loader>
|
||||
<class-name>com.company.app.DBLoader</class-name>
|
||||
<!-- pass the bean definition template name
|
||||
as parameter -->
|
||||
<parameter name="bean-name">
|
||||
<string>template-bean</string>
|
||||
</parameter>
|
||||
</cache-loader></programlisting>
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean id="dataSource" ... />
|
||||
|
||||
<!-- template bean definition -->
|
||||
<bean id="template-bean" abstract="true" p:dataSource-ref="dataSource"/>
|
||||
|
||||
</beans></programlisting>
|
||||
|
||||
<note>
|
||||
<para>The <emphasis>template</emphasis> bean definitions do not have
|
||||
to be declared in XML - any format is allowed (Groovy, annotations,
|
||||
etc..).</para>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id="apis:declarable:autowiring">
|
||||
<title>Configuration using auto-wiring and annotations</title>
|
||||
|
||||
<para>If no bean definition is found, by default,
|
||||
<classname>WiringDeclarableSupport</classname> will <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factory-autowire">autowire</ulink>
|
||||
the declaring instance. This means that unless any dependency injection
|
||||
<emphasis>metadata</emphasis> is offered by the instance, the container
|
||||
will find the object setters and try to automatically satisfy these
|
||||
dependencies. However, one can also use JDK 5 annotations to provide
|
||||
additional information to the auto-wiring process. We strongly recommend
|
||||
reading the dedicated <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-annotation-config">chapter</ulink>
|
||||
in the Spring documentation for more information on the supported
|
||||
annotations and enabling factors.</para>
|
||||
|
||||
<para>For example, the hypothetical <literal>DBLoader</literal>
|
||||
declaration above can be injected with a Spring-configured
|
||||
<interface>DataSource</interface> in the following way:</para>
|
||||
|
||||
<programlisting language="java">public class DBLoader extends WiringDeclarableSupport implements CacheLoader {
|
||||
// use annotations to 'mark' the needed dependencies
|
||||
@javax.inject.Inject
|
||||
private DataSource dataSource;
|
||||
|
||||
public Object load(LoaderHelper helper) { ... }
|
||||
}</programlisting>
|
||||
|
||||
<programlisting language="xml"><cache-loader>
|
||||
<class-name>com.company.app.DBLoader</class-name>
|
||||
<!-- no need to declare any parameters anymore
|
||||
since the class is auto-wired -->
|
||||
</cache-loader></programlisting>
|
||||
|
||||
<programlisting language="xml"><?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
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">
|
||||
|
||||
<!-- enable annotation processing -->
|
||||
<context:annotation-config/>
|
||||
|
||||
</beans></programlisting>
|
||||
|
||||
<para>By using the JSR-330 annotations, the cache loader code has been
|
||||
simplified since the location and creation of the DataSource has been
|
||||
externalized and the user code is concerned only with the loading
|
||||
process. The <interfacename>DataSource</interfacename> might be
|
||||
transactional, created lazily, shared between multiple objects or
|
||||
retrieved from JNDI - these aspects can be easily configured and changed
|
||||
through the Spring container without touching the
|
||||
<classname>DBLoader</classname> code.</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
27
docs/src/reference/docbkx/reference/introduction.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<partintro>
|
||||
<title>Document structure</title>
|
||||
|
||||
<para>This part of the reference documentation explains the core functionality
|
||||
offered by Spring GemFire integration.</para>
|
||||
|
||||
<para><xref linkend="bootstrap"/> describes the configuration support provided for
|
||||
bootstrapping, initializing and accessing a GemFire cache or region.</para>
|
||||
|
||||
<para><xref linkend="apis"/> explains the integration between GemFire API and
|
||||
the various "data" features available in Spring, such as transaction management
|
||||
and exception translation.
|
||||
</para>
|
||||
|
||||
<para><xref linkend="serialization"/> describes the enhancements for GemFire
|
||||
(de)serialization process and management of associated objects.
|
||||
</para>
|
||||
|
||||
<para><xref linkend="samples"/> describes the samples provided with the distribution
|
||||
for showcasing the various features available in Spring GemFire.
|
||||
</para>
|
||||
|
||||
<!--
|
||||
<para><xref linkend="testing"/> showcases various ways of testing GemFire inside
|
||||
Spring framework.</para>
|
||||
-->
|
||||
</partintro>
|
||||
132
docs/src/reference/docbkx/reference/samples.xml
Normal file
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="samples">
|
||||
<title>Sample Applications</title>
|
||||
|
||||
<para>The Spring GemFire project includes one sample application. Named
|
||||
"Hello World", the sample demonstrates how to configure and use GemFire
|
||||
inside a Spring application. At runtime, the sample offers a
|
||||
<emphasis>shell</emphasis> to the user allowing him to run various commands
|
||||
against the grid. It provides an excellent starting point for users
|
||||
unfamiliar with the essential components or the Spring and GemFire
|
||||
concepts.</para>
|
||||
|
||||
<para>The sample is bundled with the distribution and is Maven-based. One
|
||||
can easily import them into any Maven-aware IDE (such as SpringSource <ulink
|
||||
url="http://www.springsource.com/products/sts">Tool Suite</ulink>) or run
|
||||
them from the command-line.</para>
|
||||
|
||||
<section id="samples:hello-world">
|
||||
<title>Hello World</title>
|
||||
|
||||
<para>The Hello World sample demonstrates the core functionality of the
|
||||
Spring GemFire project. It bootstraps GemFire, configures it, executes
|
||||
arbitrary commands against it and shuts it down when the application
|
||||
exits. Multiple instances can be started at the same time as they will
|
||||
work with each other sharing data without any user intervention.</para>
|
||||
|
||||
<note>
|
||||
<title>Running under Linux</title>
|
||||
<para>If you experience networking problems when starting GemFire or the samples,
|
||||
try adding the following system property <literal>java.net.preferIPv4Stack=true</literal>
|
||||
to the command line (insert <literal>-Djava.net.preferIPv4Stack=true</literal>).
|
||||
For an alternative (global) fix especially on Ubuntu see
|
||||
this <ulink url="https://jira.springsource.org/browse/SGF-28">link</ulink></para>
|
||||
</note>
|
||||
<section id="samples:hello-world:start-stop">
|
||||
<title>Starting and stopping the sample</title>
|
||||
|
||||
<para>Hello World is designed as a stand-alone java application. It
|
||||
features a <classname>Main</classname> class which can be started either
|
||||
from your IDE of choice (in Eclipse/STS through <literal>Run As/Java
|
||||
Application</literal>) or from the command line through Maven using
|
||||
<literal>mvn exec:java</literal>. One can also use
|
||||
<literal>java</literal> directly on the resulting artifact if the
|
||||
classpath is properly set.</para>
|
||||
|
||||
<para>To stop the sample, simply type <literal>exit</literal> at the
|
||||
command line or press <literal>Ctrl+C</literal> to stop the VM and
|
||||
shutdown the Spring container.</para>
|
||||
</section>
|
||||
|
||||
<section id="samples:hello-world:run">
|
||||
<title>Using the sample</title>
|
||||
|
||||
<para>Once started, the sample will create a shared data grid and allow
|
||||
the user to issue commands against it. The output will likely look as
|
||||
follows:</para>
|
||||
|
||||
<programlisting>INFO: Created GemFire Cache [Spring GemFire World] v. X.Y.Z
|
||||
INFO: Created new cache region [myWorld]
|
||||
INFO: Member xxxxxx:50694/51611 connecting to region [myWorld]
|
||||
Hello World!
|
||||
Want to interact with the world ? ...
|
||||
Supported commands are:
|
||||
|
||||
get <key> - retrieves an entry (by key) from the grid
|
||||
put <key> <value> - puts a new entry into the grid
|
||||
remove <key> - removes an entry (by key) from the grid
|
||||
...</programlisting>
|
||||
|
||||
<para>For example to add new items to the grid one can use:</para>
|
||||
|
||||
<programlisting>-> <emphasis role="bold">put 1 unu</emphasis>
|
||||
INFO: Added [1=unu] to the cache
|
||||
null
|
||||
-> <emphasis role="bold">put 1 one</emphasis>
|
||||
INFO: Updated [1] from [unu] to [one]
|
||||
unu
|
||||
-> <emphasis role="bold">size</emphasis>
|
||||
1
|
||||
-> <emphasis role="bold">put 2 two</emphasis>
|
||||
INFO: Added [2=two] to the cache
|
||||
null
|
||||
-> <emphasis role="bold">size</emphasis>
|
||||
2</programlisting>
|
||||
|
||||
<para>Multiple instances can be created at the same time. Once started,
|
||||
the new VMs automatically see the existing region and its
|
||||
information:</para>
|
||||
|
||||
<programlisting>INFO: Connected to Distributed System ['Spring GemFire World'=xxxx:56218/49320@yyyyy]
|
||||
Hello World!
|
||||
...
|
||||
|
||||
-> <emphasis role="bold">size</emphasis>
|
||||
2
|
||||
-> <emphasis role="bold">map</emphasis>
|
||||
[2=two] [1=one]
|
||||
-> <emphasis role="bold">query length = 3</emphasis>
|
||||
[one, two]
|
||||
</programlisting>
|
||||
|
||||
<para>Experiment with the example, start (and stop) as many instances as
|
||||
you want, run various commands in one instance and see how the others
|
||||
react. To preserve data, at least one instance needs to be alive all
|
||||
times - if all instances are shutdown, the grid data is completely
|
||||
destroyed (in this example - to preserve data between runs, see the
|
||||
GemFire documentations).</para>
|
||||
</section>
|
||||
|
||||
<section id="samples:hello-world:explained">
|
||||
<title>Hello World Sample Explained</title>
|
||||
|
||||
<para>Hello World uses both Spring XML and annotations for its
|
||||
configuration. The initial boostrapping configuration is
|
||||
<literal>app-context.xml</literal> which includes the cache
|
||||
configuration, defined under <literal>cache-context.xml</literal> file
|
||||
and performs classpath <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-classpath-scanning">scanning</ulink>
|
||||
for Spring <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/beans.html#beans-factorybeans-annotations">components</ulink>.
|
||||
The cache configuration defines the GemFire cache, region and for
|
||||
illustrative purposes a simple cache listener that acts as a
|
||||
logger.</para>
|
||||
|
||||
<para>The main <emphasis>beans</emphasis> are
|
||||
<literal>HelloWorld</literal> and <literal>CommandProcessor</literal>
|
||||
which rely on the <classname>GemfireTemplate</classname> to interact
|
||||
with the distributed fabric. Both classes use annotations to define
|
||||
their dependency and life-cycle callbacks.</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
87
docs/src/reference/docbkx/reference/serialization.xml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="serialization">
|
||||
<title>Working with GemFire Serialization</title>
|
||||
|
||||
<para>To improve overall performance of the data fabric, GemFire supports a
|
||||
dedicated serialization protocol that is both faster and offers more compact
|
||||
results over the standard Java serialization and works transparently across
|
||||
various language <ulink
|
||||
url="http://community.gemstone.com/display/gemfire/Interoperability">platforms</ulink>
|
||||
(such as <ulink
|
||||
url="http://community.gemstone.com/display/gemfire/Serialization+in+Java">Java</ulink>,
|
||||
<ulink
|
||||
url="http://community.gemstone.com/display/gemfire/Serialization+in+.NET">.NET</ulink>
|
||||
and C++). This chapter discusses the various ways in which SGF simplifies
|
||||
and improves GemFire custom serialization in Java.</para>
|
||||
|
||||
<section id="serialization:wiring">
|
||||
<title>Wiring deserialized instances</title>
|
||||
|
||||
<para>It is fairly common for serialized objects to have transient data.
|
||||
Transient data is often dependent on the node or environment where it
|
||||
lives at a certain point in time, for example a DataSource. Serializing
|
||||
such information is useless (and potentially even dangerous) since it is
|
||||
local to a certain VM/machine. For such cases, SGF offers a special <ulink
|
||||
url="http://www.gemstone.com/docs/6.0.1/product/docs/japi/com/gemstone/gemfire/Instantiator.html"><classname>Instantiator</classname></ulink>
|
||||
that performs wiring for each new instance created by GemFire during
|
||||
deserialization.</para>
|
||||
|
||||
<para>Through such a mechanism, one can rely on the Spring container to
|
||||
inject (and manage) certain dependencies making it easy to split transient
|
||||
from persistent data and have <emphasis>rich domain objects</emphasis> in
|
||||
a transparent manner (Spring users might find this approach similar to
|
||||
that of <ulink
|
||||
url="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/aop.html#aop-atconfigurable"><literal>@Configurable</literal></ulink>).
|
||||
The <classname>WiringInstantiator</classname> works just like
|
||||
<classname>WiringDeclarableSupport</classname>, trying to first locate a
|
||||
bean definition as a wiring template and following to autowiring
|
||||
otherwise. Please refer to the previous section (<xref
|
||||
linkend="apis:declarable"/>) for more details on wiring
|
||||
functionality.</para>
|
||||
|
||||
<para>To use this <classname>Instantiator</classname>, simply declare it
|
||||
as a usual bean:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="instantiator" class="org.springframework.data.gemfire.serialization.WiringInstantiator">
|
||||
<!-- DataSerializable type -->
|
||||
<constructor-arg>org.pkg.SomeDataSerializableClass</constructor-arg>
|
||||
<!-- type id -->
|
||||
<constructor-arg>95</constructor-arg>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>During the container startup, once it is being initialized, the
|
||||
<literal>instantiator</literal> will, by default, register itself with the
|
||||
GemFire system and perform wiring on all instances of
|
||||
<classname>SomeDataSerializableClass</classname> created by GemFire during
|
||||
deserialization.</para>
|
||||
</section>
|
||||
|
||||
<section id="serialization:instance-generator">
|
||||
<title>Auto-generating custom <classname>Instantiator</classname>s</title>
|
||||
|
||||
<para>For data intensive applications, a large number of instances might
|
||||
be created on each machine as data flows in. Out of the box, GemFire uses
|
||||
reflection to create new types but for some scenarios, this might prove to
|
||||
be expensive. As always, it is good to perform profiling to quantify
|
||||
whether this is the case or not. For such cases, SGF allows the automatic
|
||||
generation of <classname>Instatiator</classname> classes which instantiate
|
||||
a new type (using the default constructor) without the use of
|
||||
reflection:</para>
|
||||
|
||||
<programlisting language="xml"><bean id="instantiator-factory" class="org.springframework.data.gemfire.serialization.InstantiatorFactoryBean">
|
||||
<property name="customTypes">
|
||||
<map>
|
||||
<entry key="org.pkg.CustomTypeA" value="1025"/>
|
||||
<entry key="org.pkg.CustomTypeB" value="1026"/>
|
||||
</map>
|
||||
</property>
|
||||
</bean></programlisting>
|
||||
|
||||
<para>The definition above, automatically generated two
|
||||
<classname>Instantiator</classname>s for two classes, namely
|
||||
<classname>CustomTypeA</classname> and <classname>CustomTypeB</classname>
|
||||
and registers them with GemFire, under user id <literal>1025</literal> and
|
||||
<literal>1026</literal>. The two instantiators avoid the use of reflection
|
||||
and create the instances directly through Java code.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
15
docs/src/reference/docbkx/reference/testing.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="bootstrap">
|
||||
<title>Bootstrapping GemFire through the Spring container</title>
|
||||
|
||||
<para>
|
||||
</para>
|
||||
|
||||
<section id="bootstrap:requirements">
|
||||
<title>Requirements</title>
|
||||
<para></para>
|
||||
<note>
|
||||
</note>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
35
docs/src/reference/resources/css/highlight.css
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
code highlight CSS resemblign the Eclipse IDE default color schema
|
||||
@author Costin Leau
|
||||
*/
|
||||
|
||||
.hl-keyword {
|
||||
color: #7F0055;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hl-comment {
|
||||
color: #3F5F5F;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hl-multiline-comment {
|
||||
color: #3F5FBF;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hl-tag {
|
||||
color: #3F7F7F;
|
||||
}
|
||||
|
||||
.hl-attribute {
|
||||
color: #7F007F;
|
||||
}
|
||||
|
||||
.hl-value {
|
||||
color: #2A00FF;
|
||||
}
|
||||
|
||||
.hl-string {
|
||||
color: #2A00FF;
|
||||
}
|
||||
99
docs/src/reference/resources/css/manual.css
Normal file
@@ -0,0 +1,99 @@
|
||||
@IMPORT url("highlight.css");
|
||||
|
||||
html {
|
||||
padding: 0pt;
|
||||
margin: 0pt;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
font-family: Arial, Sans-serif;
|
||||
}
|
||||
|
||||
div {
|
||||
margin: 0pt;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 1px solid gray;
|
||||
background: gray;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4 {
|
||||
color: #234623;
|
||||
font-family: Arial, Sans-serif;
|
||||
}
|
||||
|
||||
pre {
|
||||
line-height: 1.0;
|
||||
color: black;
|
||||
}
|
||||
|
||||
pre.programlisting {
|
||||
font-size: 10pt;
|
||||
padding: 7pt 3pt;
|
||||
border: 1pt solid black;
|
||||
background: #eeeeee;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
div.table {
|
||||
margin: 1em;
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.table table {
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.table td {
|
||||
padding-left: 7px;
|
||||
padding-right: 7px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
float: right;
|
||||
margin: 10px 0 10px 30px;
|
||||
padding: 10px 20px 20px 20px;
|
||||
width: 33%;
|
||||
border: 1px solid black;
|
||||
background-color: #F4F4F4;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.mediaobject {
|
||||
padding-top: 30px;
|
||||
padding-bottom: 30px;
|
||||
}
|
||||
|
||||
.legalnotice {
|
||||
font-family: Verdana, Arial, helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
p.releaseinfo {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
font-family: Verdana, Arial, helvetica, sans-serif;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
p.pubdate {
|
||||
font-size: 120%;
|
||||
font-weight: bold;
|
||||
font-family: Verdana, Arial, helvetica, sans-serif;
|
||||
}
|
||||
|
||||
span.productname {
|
||||
font-size: 200%;
|
||||
font-weight: bold;
|
||||
font-family: Verdana, Arial, helvetica, sans-serif;
|
||||
}
|
||||
BIN
docs/src/reference/resources/images/admon/blank.png
Normal file
|
After Width: | Height: | Size: 374 B |
BIN
docs/src/reference/resources/images/admon/caution.gif
Normal file
|
After Width: | Height: | Size: 743 B |
BIN
docs/src/reference/resources/images/admon/caution.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
docs/src/reference/resources/images/admon/caution.tif
Normal file
BIN
docs/src/reference/resources/images/admon/draft.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
docs/src/reference/resources/images/admon/home.gif
Normal file
|
After Width: | Height: | Size: 321 B |
BIN
docs/src/reference/resources/images/admon/home.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/important.gif
Normal file
|
After Width: | Height: | Size: 1003 B |
BIN
docs/src/reference/resources/images/admon/important.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
docs/src/reference/resources/images/admon/important.tif
Normal file
BIN
docs/src/reference/resources/images/admon/next.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/next.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/note.gif
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
docs/src/reference/resources/images/admon/note.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
docs/src/reference/resources/images/admon/note.tif
Normal file
BIN
docs/src/reference/resources/images/admon/prev.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/prev.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/tip.gif
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
docs/src/reference/resources/images/admon/tip.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
docs/src/reference/resources/images/admon/tip.tif
Normal file
BIN
docs/src/reference/resources/images/admon/toc-blank.png
Normal file
|
After Width: | Height: | Size: 318 B |
BIN
docs/src/reference/resources/images/admon/toc-minus.png
Normal file
|
After Width: | Height: | Size: 259 B |
BIN
docs/src/reference/resources/images/admon/toc-plus.png
Normal file
|
After Width: | Height: | Size: 264 B |
BIN
docs/src/reference/resources/images/admon/up.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/up.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
docs/src/reference/resources/images/admon/warning.gif
Normal file
|
After Width: | Height: | Size: 613 B |
BIN
docs/src/reference/resources/images/admon/warning.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
docs/src/reference/resources/images/admon/warning.tif
Normal file
BIN
docs/src/reference/resources/images/callouts/1.png
Normal file
|
After Width: | Height: | Size: 329 B |
BIN
docs/src/reference/resources/images/callouts/10.png
Normal file
|
After Width: | Height: | Size: 361 B |
BIN
docs/src/reference/resources/images/callouts/11.png
Normal file
|
After Width: | Height: | Size: 565 B |
BIN
docs/src/reference/resources/images/callouts/12.png
Normal file
|
After Width: | Height: | Size: 617 B |
BIN
docs/src/reference/resources/images/callouts/13.png
Normal file
|
After Width: | Height: | Size: 623 B |
BIN
docs/src/reference/resources/images/callouts/14.png
Normal file
|
After Width: | Height: | Size: 411 B |
BIN
docs/src/reference/resources/images/callouts/15.png
Normal file
|
After Width: | Height: | Size: 640 B |
BIN
docs/src/reference/resources/images/callouts/2.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
docs/src/reference/resources/images/callouts/3.png
Normal file
|
After Width: | Height: | Size: 350 B |
BIN
docs/src/reference/resources/images/callouts/4.png
Normal file
|
After Width: | Height: | Size: 345 B |
BIN
docs/src/reference/resources/images/callouts/5.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
docs/src/reference/resources/images/callouts/6.png
Normal file
|
After Width: | Height: | Size: 355 B |
BIN
docs/src/reference/resources/images/callouts/7.png
Normal file
|
After Width: | Height: | Size: 344 B |
BIN
docs/src/reference/resources/images/callouts/8.png
Normal file
|
After Width: | Height: | Size: 357 B |
BIN
docs/src/reference/resources/images/callouts/9.png
Normal file
|
After Width: | Height: | Size: 357 B |
BIN
docs/src/reference/resources/images/logo.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
BIN
docs/src/reference/resources/images/xdev-spring_logo.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
449
docs/src/reference/resources/xsl/fopdf.xsl
Normal file
@@ -0,0 +1,449 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
This is the XSL FO (PDF) stylesheet for the Spring Data reference
|
||||
documentation.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version="1.0">
|
||||
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="highlight-fo.xsl"/>
|
||||
|
||||
<!--###################################################
|
||||
Custom Title Page
|
||||
################################################### -->
|
||||
|
||||
<xsl:template name="book.titlepage.recto">
|
||||
<fo:block>
|
||||
<fo:table table-layout="fixed" width="175mm">
|
||||
<fo:table-column column-width="175mm"/>
|
||||
<fo:table-body>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<!-- Logo
|
||||
<fo:block>
|
||||
<fo:external-graphic src="file:src/docbkx/resources/images/s2_box_logo.png"/>
|
||||
</fo:block>
|
||||
-->
|
||||
<fo:block font-family="Helvetica" font-size="22pt" padding-before="10mm">
|
||||
<xsl:value-of select="bookinfo/subtitle"/>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="14pt" padding="10mm">
|
||||
<xsl:value-of select="bookinfo/title"/>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
||||
<xsl:value-of select="bookinfo/releaseinfo"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<fo:block font-family="Helvetica" font-size="14pt" padding="10mm">
|
||||
<xsl:value-of select="bookinfo/pubdate"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
<fo:table-row>
|
||||
<fo:table-cell text-align="center">
|
||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
||||
<xsl:for-each select="bookinfo/authorgroup/author">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="firstname"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="surname"/>
|
||||
<xsl:text> (</xsl:text>
|
||||
<xsl:value-of select="affiliation"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:for-each>
|
||||
</fo:block>
|
||||
<fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
|
||||
<xsl:text>Copyright © 2010-2011</xsl:text>
|
||||
</fo:block>
|
||||
|
||||
<fo:block font-family="Helvetica" font-size="10pt" padding="1mm">
|
||||
<xsl:value-of select="bookinfo/legalnotice"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Prevent blank pages in output -->
|
||||
<xsl:template name="book.titlepage.before.verso">
|
||||
</xsl:template>
|
||||
<xsl:template name="book.titlepage.verso">
|
||||
</xsl:template>
|
||||
<xsl:template name="book.titlepage.separator">
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Header
|
||||
################################################### -->
|
||||
|
||||
<!-- More space in the center header for long text -->
|
||||
<xsl:attribute-set name="header.content.properties">
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$body.font.family"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">-5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Custom Footer
|
||||
################################################### -->
|
||||
<xsl:template name="footer.content">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="position" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
<xsl:variable name="Version">
|
||||
<xsl:if test="//releaseinfo">
|
||||
<xsl:text>Spring Data Redis (</xsl:text><xsl:value-of select="//releaseinfo" /><xsl:text>)</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence='blank'">
|
||||
<xsl:if test="$position = 'center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<!-- for double sided printing, print page numbers on alternating sides (of the page) -->
|
||||
<xsl:when test="$double.sided != 0">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence = 'even' and $position='left'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$sequence = 'odd' and $position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<!-- for single sided printing, print all page numbers on the right (of the page) -->
|
||||
<xsl:when test="$double.sided = 0">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Extensions
|
||||
################################################### -->
|
||||
|
||||
<!-- These extensions are required for table printing and other stuff -->
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<!-- FOP provide only PDF Bookmarks at the moment -->
|
||||
<xsl:param name="fop.extensions">1</xsl:param>
|
||||
<xsl:param name="fop1.extensions">1</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">0</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Table Of Contents
|
||||
################################################### -->
|
||||
|
||||
<!-- Generate the TOCs for named components only -->
|
||||
<xsl:param name="generate.toc">
|
||||
book toc
|
||||
</xsl:param>
|
||||
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">2</xsl:param>
|
||||
|
||||
<!-- Dot and Whitespace as separator in TOC between Label and Title-->
|
||||
<xsl:param name="autotoc.label.separator" select="'. '"/>
|
||||
|
||||
|
||||
<!--###################################################
|
||||
Paper & Page Size
|
||||
################################################### -->
|
||||
|
||||
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
||||
<xsl:param name="paper.type" select="'A4'"/>
|
||||
<xsl:param name="double.sided">0</xsl:param>
|
||||
<xsl:param name="headers.on.blank.pages">0</xsl:param>
|
||||
<xsl:param name="footers.on.blank.pages">0</xsl:param>
|
||||
|
||||
<!-- Space between paper border and content (chaotic stuff, don't touch) -->
|
||||
<xsl:param name="page.margin.top">5mm</xsl:param>
|
||||
<xsl:param name="region.before.extent">10mm</xsl:param>
|
||||
<xsl:param name="body.margin.top">10mm</xsl:param>
|
||||
|
||||
<xsl:param name="body.margin.bottom">15mm</xsl:param>
|
||||
<xsl:param name="region.after.extent">10mm</xsl:param>
|
||||
<xsl:param name="page.margin.bottom">0mm</xsl:param>
|
||||
|
||||
<xsl:param name="page.margin.outer">18mm</xsl:param>
|
||||
<xsl:param name="page.margin.inner">18mm</xsl:param>
|
||||
|
||||
<!-- No intendation of Titles -->
|
||||
<xsl:param name="title.margin.left">0pc</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Fonts & Styles
|
||||
################################################### -->
|
||||
|
||||
<!-- Left aligned text and no hyphenation -->
|
||||
<xsl:param name="alignment">justify</xsl:param>
|
||||
<xsl:param name="hyphenate">false</xsl:param>
|
||||
|
||||
<!-- Default Font size -->
|
||||
<xsl:param name="body.font.master">11</xsl:param>
|
||||
<xsl:param name="body.font.small">8</xsl:param>
|
||||
|
||||
<!-- Line height in body text -->
|
||||
<xsl:param name="line-height">1.4</xsl:param>
|
||||
|
||||
<!-- Monospaced fonts are smaller than regular text -->
|
||||
<xsl:attribute-set name="monospace.properties">
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$monospace.font.family"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="font-size">0.8em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Tables
|
||||
################################################### -->
|
||||
|
||||
<!-- The table width should be adapted to the paper size -->
|
||||
<xsl:param name="default.table.width">17.4cm</xsl:param>
|
||||
|
||||
<!-- Some padding inside tables -->
|
||||
<xsl:attribute-set name="table.cell.padding">
|
||||
<xsl:attribute name="padding-left">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">4pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Only hairlines as frame and cell borders in tables -->
|
||||
<xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
|
||||
<xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
|
||||
<!--###################################################
|
||||
Titles
|
||||
################################################### -->
|
||||
|
||||
<!-- Chapter title size -->
|
||||
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
||||
<xsl:attribute name="text-align">left</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.8"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
|
||||
Let's remove it, so this sucker can use our attribute-set only... -->
|
||||
<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
|
||||
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xsl:use-attribute-sets="chapter.titlepage.recto.style">
|
||||
<xsl:call-template name="component.title">
|
||||
<xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
|
||||
<xsl:attribute-set name="section.title.level1.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.5"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:attribute-set name="section.title.level2.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.25"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:attribute-set name="section.title.level3.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.0"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Titles of formal objects (tables, examples, ...) -->
|
||||
<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="hyphenate">false</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Programlistings
|
||||
################################################### -->
|
||||
|
||||
<!-- Verbatim text formatting (programlistings) -->
|
||||
<xsl:attribute-set name="monospace.verbatim.properties">
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.small * 1.0"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="verbatim.properties">
|
||||
<xsl:attribute name="space-before.minimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">1em</xsl:attribute>
|
||||
<xsl:attribute name="border-color">#444444</xsl:attribute>
|
||||
<xsl:attribute name="border-style">solid</xsl:attribute>
|
||||
<xsl:attribute name="border-width">0.1pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">0.5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Shade (background) programlistings -->
|
||||
<xsl:param name="shade.verbatim">1</xsl:param>
|
||||
<xsl:attribute-set name="shade.verbatim.style">
|
||||
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
|
||||
<!-- Use images for callouts instead of (1) (2) (3) -->
|
||||
<xsl:param name="callout.graphics">0</xsl:param>
|
||||
<xsl:param name="callout.unicode">1</xsl:param>
|
||||
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Admonitions
|
||||
################################################### -->
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">'1'</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">src/docbkx/resources/images/admons/</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
example before
|
||||
equation before
|
||||
table before
|
||||
procedure before
|
||||
</xsl:param>
|
||||
|
||||
<!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
|
||||
<xsl:param name="variablelist.as.blocks">1</xsl:param>
|
||||
|
||||
<!-- The horrible list spacing problems -->
|
||||
<xsl:attribute-set name="list.block.spacing">
|
||||
<xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
colored and hyphenated links
|
||||
################################################### -->
|
||||
<xsl:template match="ulink">
|
||||
<fo:basic-link external-destination="{@url}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
<xsl:value-of select="@url"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="link">
|
||||
<fo:basic-link internal-destination="{@linkend}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
<xsl:value-of select="@linkend"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
<!--
|
||||
|
||||
<xsl:template match="xref">
|
||||
<fo:basic-link internal-destination="{@linkend}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:apply-templates/>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
-->
|
||||
|
||||
</xsl:stylesheet>
|
||||
44
docs/src/reference/resources/xsl/highlight-fo.xsl
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version='1.0'?>
|
||||
<!--
|
||||
Simple highlighter for FO/PDF output. Follows the Eclipse color scheme.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:template match='xslthl:keyword'>
|
||||
<fo:inline font-weight="bold" color="#7F0055"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment'>
|
||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment'>
|
||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment'>
|
||||
<fo:inline font-style="italic" color="#3F5FBF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag'>
|
||||
<fo:inline color="#3F7F7F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute'>
|
||||
<fo:inline olor="#7F007F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value'>
|
||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string'>
|
||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
42
docs/src/reference/resources/xsl/highlight.xsl
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version='1.0'?>
|
||||
<!--
|
||||
Simple highlighter for HTML output. Follows the Eclipse color scheme.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:template match='xslthl:keyword'>
|
||||
<span class="hl-keyword"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment'>
|
||||
<span class="hl-comment"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment'>
|
||||
<span class="hl-comment"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment'>
|
||||
<span class="hl-multiline-comment"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag'>
|
||||
<span class="hl-tag"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute'>
|
||||
<span class="hl-attribute"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value'>
|
||||
<span class="hl-value"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string'>
|
||||
<span class="hl-string"><xsl:value-of select='.'/></span>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
145
docs/src/reference/resources/xsl/html-custom.xsl
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/highlight.xsl"/>
|
||||
|
||||
<xsl:param name="chunk.section.depth">'5'</xsl:param>
|
||||
<xsl:param name="use.id.as.filename">'1'</xsl:param>
|
||||
|
||||
<!-- Only use scaling in FO -->
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
|
||||
<!-- Use code syntax highlighting -->
|
||||
<xsl:param name="highlight.source">1</xsl:param>
|
||||
|
||||
<!-- Extensions -->
|
||||
<xsl:param name="use.extensions">1</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="callout.extensions">1</xsl:param>
|
||||
|
||||
<!-- Activate Graphics -->
|
||||
<xsl:param name="admon.graphics" select="1"/>
|
||||
<xsl:param name="admon.graphics.path">images/admon/</xsl:param>
|
||||
<xsl:param name="admon.graphics.extension">.png</xsl:param>
|
||||
<xsl:param name="callout.graphics" select="1" />
|
||||
<xsl:param name="callout.defaultcolumn">120</xsl:param>
|
||||
<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
|
||||
<xsl:param name="callout.graphics.extension">.png</xsl:param>
|
||||
|
||||
<xsl:param name="table.borders.with.css" select="1"/>
|
||||
<xsl:param name="html.stylesheet">css/manual.css</xsl:param>
|
||||
<xsl:param name="html.stylesheet.type">text/css</xsl:param>
|
||||
<xsl:param name="generate.toc">book toc,title</xsl:param>
|
||||
|
||||
<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
|
||||
|
||||
<!-- Leave image paths as relative when navigating XInclude -->
|
||||
<xsl:param name="keep.relative.image.uris" select="1"/>
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel.max.depth" select="2"/>
|
||||
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="table.footnote.number.format" select="'1'"/>
|
||||
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
|
||||
<!-- Remove "Chapter" from the Chapter titles... -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
<l:template name="section" text="%n %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<xsl:template match='xslthl:keyword' mode="xslthl">
|
||||
<span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment' mode="xslthl">
|
||||
<span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag' mode="xslthl">
|
||||
<span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute' mode="xslthl">
|
||||
<span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value' mode="xslthl">
|
||||
<span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string' mode="xslthl">
|
||||
<span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<xsl:template name="user.head.content">
|
||||
<xsl:comment>Begin Google Analytics code</xsl:comment>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-2728886-3");
|
||||
pageTracker._setDomainName("none");
|
||||
pageTracker._setAllowLinker(true);
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
<xsl:comment>End Google Analytics code</xsl:comment>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Loopfuse -->
|
||||
<xsl:template name="user.footer.content">
|
||||
<xsl:comment>Begin LoopFuse code</xsl:comment>
|
||||
<script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_lf_cid = "LF_48be82fa";
|
||||
_lf_remora();
|
||||
</script>
|
||||
<xsl:comment>End LoopFuse code</xsl:comment>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
142
docs/src/reference/resources/xsl/html-single-custom.xsl
Normal file
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/highlight.xsl"/>
|
||||
|
||||
<!-- Only use scaling in FO -->
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
|
||||
<!-- Use code syntax highlighting -->
|
||||
<xsl:param name="highlight.source">1</xsl:param>
|
||||
|
||||
<!-- Extensions -->
|
||||
<xsl:param name="use.extensions">1</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="callout.extensions">1</xsl:param>
|
||||
|
||||
<!-- Activate Graphics -->
|
||||
<xsl:param name="admon.graphics" select="1"/>
|
||||
<xsl:param name="admon.graphics.path">images/admon/</xsl:param>
|
||||
<xsl:param name="admon.graphics.extension">.png</xsl:param>
|
||||
<xsl:param name="callout.graphics" select="1" />
|
||||
<xsl:param name="callout.defaultcolumn">120</xsl:param>
|
||||
<xsl:param name="callout.graphics.path">images/callouts/</xsl:param>
|
||||
<xsl:param name="callout.graphics.extension">.png</xsl:param>
|
||||
|
||||
<xsl:param name="table.borders.with.css" select="1"/>
|
||||
<xsl:param name="html.stylesheet">css/manual.css</xsl:param>
|
||||
<xsl:param name="html.stylesheet.type">text/css</xsl:param>
|
||||
<xsl:param name="generate.toc">book toc,title</xsl:param>
|
||||
|
||||
<xsl:param name="admonition.title.properties">text-align: left</xsl:param>
|
||||
|
||||
<!-- Leave image paths as relative when navigating XInclude -->
|
||||
<xsl:param name="keep.relative.image.uris" select="1"/>
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel.max.depth" select="2"/>
|
||||
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="table.footnote.number.format" select="'1'"/>
|
||||
|
||||
<!-- Show only Sections up to level 2 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">2</xsl:param>
|
||||
|
||||
<!-- Remove "Chapter" from the Chapter titles... -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
<l:template name="section" text="%n %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<xsl:template match='xslthl:keyword' mode="xslthl">
|
||||
<span class="hl-keyword"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment' mode="xslthl">
|
||||
<span class="hl-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment' mode="xslthl">
|
||||
<span class="hl-multiline-comment"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag' mode="xslthl">
|
||||
<span class="hl-tag"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute' mode="xslthl">
|
||||
<span class="hl-attribute"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value' mode="xslthl">
|
||||
<span class="hl-value"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string' mode="xslthl">
|
||||
<span class="hl-string"><xsl:apply-templates mode="xslthl"/></span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Google Analytics -->
|
||||
<xsl:template name="user.head.content">
|
||||
<xsl:comment>Begin Google Analytics code</xsl:comment>
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var pageTracker = _gat._getTracker("UA-2728886-3");
|
||||
pageTracker._setDomainName("none");
|
||||
pageTracker._setAllowLinker(true);
|
||||
pageTracker._trackPageview();
|
||||
</script>
|
||||
<xsl:comment>End Google Analytics code</xsl:comment>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Loopfuse -->
|
||||
<xsl:template name="user.footer.content">
|
||||
<xsl:comment>Begin LoopFuse code</xsl:comment>
|
||||
<script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript">
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
_lf_cid = "LF_48be82fa";
|
||||
_lf_remora();
|
||||
</script>
|
||||
<xsl:comment>End LoopFuse code</xsl:comment>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
107
docs/src/reference/resources/xsl/html.xsl
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This is the XSL HTML configuration file for the Spring
|
||||
Reference Documentation.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version="1.0">
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="highlight.xsl"/>
|
||||
|
||||
<!--###################################################
|
||||
HTML Settings
|
||||
################################################### -->
|
||||
|
||||
<!-- These extensions are required for table printing and other stuff -->
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Table Of Contents
|
||||
################################################### -->
|
||||
|
||||
<!-- Generate the TOCs for named components only -->
|
||||
<xsl:param name="generate.toc">
|
||||
book toc
|
||||
</xsl:param>
|
||||
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
|
||||
<!-- Use images for callouts instead of (1) (2) (3) -->
|
||||
<xsl:param name="callout.graphics">1</xsl:param>
|
||||
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Admonitions
|
||||
################################################### -->
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">1</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
example before
|
||||
equation before
|
||||
table before
|
||||
procedure before
|
||||
</xsl:param>
|
||||
<xsl:template match="author" mode="titlepage.mode">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'author'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:call-template name="person.name"/>
|
||||
(<xsl:value-of select="affiliation"/>)
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||
<div class="{name(.)}">
|
||||
<h2>Authors</h2>
|
||||
<p/>
|
||||
<xsl:apply-templates mode="titlepage.mode"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!--###################################################
|
||||
Headers and Footers
|
||||
################################################### -->
|
||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||
<xsl:template name="user.header.navigation">
|
||||
<div style="background-color:white;border:none;height:73px;border:1px solid black;">
|
||||
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
||||
title="The Spring Framework - Spring GemFire">
|
||||
<img style="border:none;" src="images/xdev-spring_logo.jpg"/>
|
||||
</a>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
||||
</a>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
221
docs/src/reference/resources/xsl/html_chunk.xsl
Normal file
@@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This is the XSL HTML configuration file for the Spring Reference Documentation.
|
||||
-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version="1.0">
|
||||
|
||||
<xsl:import href="urn:docbkx:stylesheet"/>
|
||||
<xsl:import href="highlight.xsl"/>
|
||||
|
||||
|
||||
<!--###################################################
|
||||
HTML Settings
|
||||
################################################### -->
|
||||
<xsl:param name="chunk.section.depth">'5'</xsl:param>
|
||||
<xsl:param name="use.id.as.filename">'1'</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="graphicsize.extension">0</xsl:param>
|
||||
<xsl:param name="ignore.image.scaling">1</xsl:param>
|
||||
<!--###################################################
|
||||
Table Of Contents
|
||||
################################################### -->
|
||||
<!-- Generate the TOCs for named components only -->
|
||||
<xsl:param name="generate.toc">
|
||||
book toc
|
||||
qandaset toc
|
||||
</xsl:param>
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel">1</xsl:param>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.graphics">1</xsl:param>
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Admonitions
|
||||
################################################### -->
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">1</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">images/admons/</xsl:param>
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
example before
|
||||
equation before
|
||||
table before
|
||||
procedure before
|
||||
</xsl:param>
|
||||
<xsl:template match="author" mode="titlepage.mode">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'author'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:call-template name="person.name"/>
|
||||
(<xsl:value-of select="affiliation"/>)
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./contrib"/>
|
||||
<!--
|
||||
<xsl:apply-templates mode="titlepage.mode" select="./affiliation"/>
|
||||
-->
|
||||
</span>
|
||||
</xsl:template>
|
||||
<xsl:template match="authorgroup" mode="titlepage.mode">
|
||||
<div class="{name(.)}">
|
||||
<h2>Authors</h2>
|
||||
<p/>
|
||||
<xsl:apply-templates mode="titlepage.mode"/>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!--###################################################
|
||||
Headers and Footers
|
||||
################################################### -->
|
||||
<!-- let's have a Spring and I21 banner across the top of each page -->
|
||||
<xsl:template name="user.header.navigation">
|
||||
<div style="background-color:white;border:none;height:73px;border:1px solid black;">
|
||||
<a style="border:none;" href="http://www.springframework.org/osgi/"
|
||||
title="The Spring Framework - Spring GemFire">
|
||||
<img style="border:none;" src="images/xdev-spring_logo.jpg"/>
|
||||
</a>
|
||||
<a style="border:none;" href="http://www.SpringSource.com/" title="SpringSource - Spring from the Source">
|
||||
<img style="border:none;position:absolute;padding-top:5px;right:42px;" src="images/s2-banner-rhs.png"/>
|
||||
</a>
|
||||
</div>
|
||||
</xsl:template>
|
||||
<!-- no other header navigation (prev, next, etc.) -->
|
||||
<xsl:template name="header.navigation"/>
|
||||
<xsl:param name="navig.showtitles">1</xsl:param>
|
||||
<!-- let's have a 'Sponsored by SpringSource' strapline (or somesuch) across the bottom of each page -->
|
||||
<xsl:template name="footer.navigation">
|
||||
<xsl:param name="prev" select="/foo"/>
|
||||
<xsl:param name="next" select="/foo"/>
|
||||
<xsl:param name="nav.context"/>
|
||||
<xsl:variable name="home" select="/*[1]"/>
|
||||
<xsl:variable name="up" select="parent::*"/>
|
||||
<xsl:variable name="row1" select="count($prev) > 0
|
||||
or count($up) > 0
|
||||
or count($next) > 0"/>
|
||||
<xsl:variable name="row2" select="($prev and $navig.showtitles != 0)
|
||||
or (generate-id($home) != generate-id(.)
|
||||
or $nav.context = 'toc')
|
||||
or ($chunk.tocs.and.lots != 0
|
||||
and $nav.context != 'toc')
|
||||
or ($next and $navig.showtitles != 0)"/>
|
||||
<xsl:if test="$suppress.navigation = '0' and $suppress.footer.navigation = '0'">
|
||||
<div class="navfooter">
|
||||
<xsl:if test="$footer.rule != 0">
|
||||
<hr/>
|
||||
</xsl:if>
|
||||
<xsl:if test="$row1 or $row2">
|
||||
<table width="100%" summary="Navigation footer">
|
||||
<xsl:if test="$row1">
|
||||
<tr>
|
||||
<td width="40%" align="left">
|
||||
<xsl:if test="count($prev)>0">
|
||||
<a accesskey="p">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$prev"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
<xsl:with-param name="direction" select="'prev'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
</td>
|
||||
|
||||
<td width="20%" align="center">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$home != . or $nav.context = 'toc'">
|
||||
<a accesskey="h">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$home"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
<xsl:with-param name="direction" select="'home'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
||||
<xsl:text> | </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> </xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="$chunk.tocs.and.lots != 0 and $nav.context != 'toc'">
|
||||
<a accesskey="t">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:apply-templates select="/*[1]" mode="recursive-chunk-filename">
|
||||
<xsl:with-param name="recursive" select="true()"/>
|
||||
</xsl:apply-templates>
|
||||
<xsl:text>-toc</xsl:text>
|
||||
<xsl:value-of select="$html.ext"/>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="gentext">
|
||||
<xsl:with-param name="key" select="'nav-toc'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
</xsl:if>
|
||||
</td>
|
||||
<td width="40%" align="right">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="count($next)>0">
|
||||
<a accesskey="n">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$next"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
<xsl:with-param name="direction" select="'next'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
</xsl:if>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
<xsl:if test="$row2">
|
||||
<tr>
|
||||
<td width="40%" align="left" valign="top">
|
||||
<xsl:if test="$navig.showtitles != 0">
|
||||
<xsl:apply-templates select="$prev" mode="object.title.markup"/>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
</td>
|
||||
<td width="20%" align="center">
|
||||
<span style="color:white;font-size:90%;">
|
||||
<a href="http://www.SpringSource.com/"
|
||||
title="SpringSource - Spring from the Source">Sponsored by SpringSource
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
<td width="40%" align="right" valign="top">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="$navig.showtitles != 0">
|
||||
<xsl:apply-templates select="$next" mode="object.title.markup"/>
|
||||
</xsl:if>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</table>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
522
docs/src/reference/resources/xsl/pdf-custom.xsl
Normal file
@@ -0,0 +1,522 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xslthl="http://xslthl.sf.net"
|
||||
exclude-result-prefixes="xslthl"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/highlight.xsl"/>
|
||||
|
||||
<!-- Use nice graphics for admonitions -->
|
||||
<xsl:param name="admon.graphics">'1'</xsl:param>
|
||||
<xsl:param name="admon.graphics.path">images/admon/</xsl:param>
|
||||
<xsl:param name="admon.graphics.extension">.png</xsl:param>
|
||||
|
||||
<!-- resize the admon graphics. they're width 36pt by default
|
||||
even though the graphics that ship with docbook are 24x24 -->
|
||||
<xsl:template match="*" mode="admon.graphic.width">
|
||||
<xsl:param name="node" select="."/>
|
||||
<xsl:text>24pt</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:param name="paper.type" select="'A4'"/>
|
||||
<xsl:param name="page.margin.top" select="'1cm'"/>
|
||||
<xsl:param name="region.before.extent" select="'1cm'"/>
|
||||
<xsl:param name="body.margin.top" select="'1.5cm'"/>
|
||||
|
||||
<xsl:param name="body.margin.bottom" select="'1.5cm'"/>
|
||||
<xsl:param name="region.after.extent" select="'1cm'"/>
|
||||
<xsl:param name="page.margin.bottom" select="'1cm'"/>
|
||||
<xsl:param name="title.margin.left" select="'0cm'"/>
|
||||
|
||||
<!--###################################################
|
||||
Header
|
||||
################################################### -->
|
||||
|
||||
<!-- More space in the center header for long text -->
|
||||
<xsl:attribute-set name="header.content.properties">
|
||||
<xsl:attribute name="font-family">
|
||||
<xsl:value-of select="$body.font.family"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">-5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">-5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Table of Contents
|
||||
################################################### -->
|
||||
|
||||
<xsl:param name="generate.toc">
|
||||
book toc,title
|
||||
</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Custom Header
|
||||
################################################### -->
|
||||
|
||||
<xsl:template name="header.content">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="position" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
|
||||
<xsl:variable name="Version">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//productname">
|
||||
<xsl:value-of select="//productname"/><xsl:text> </xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>please define productname in your docbook file!</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence='blank'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$pageclass='titlepage'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Custom Footer
|
||||
################################################### -->
|
||||
|
||||
<xsl:template name="footer.content">
|
||||
<xsl:param name="pageclass" select="''"/>
|
||||
<xsl:param name="sequence" select="''"/>
|
||||
<xsl:param name="position" select="''"/>
|
||||
<xsl:param name="gentext-key" select="''"/>
|
||||
|
||||
<xsl:variable name="Version">
|
||||
<xsl:choose>
|
||||
<xsl:when test="//releaseinfo">
|
||||
<xsl:value-of select="//releaseinfo"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="Title">
|
||||
<xsl:value-of select="//title"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$sequence='blank'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$double.sided != 0 and $position = 'left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position = 'center'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<fo:page-number/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$pageclass='titlepage'">
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position='right'">
|
||||
<fo:page-number/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$double.sided = 0 and $position='left'">
|
||||
<xsl:value-of select="$Version"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="$position='center'">
|
||||
<xsl:value-of select="$Title"/>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="processing-instruction('hard-pagebreak')">
|
||||
<fo:block break-before='page'/>
|
||||
</xsl:template>
|
||||
|
||||
<!--###################################################
|
||||
Extensions
|
||||
################################################### -->
|
||||
|
||||
<!-- These extensions are required for table printing and other stuff -->
|
||||
<xsl:param name="use.extensions">1</xsl:param>
|
||||
<xsl:param name="tablecolumns.extension">0</xsl:param>
|
||||
<xsl:param name="callout.extensions">1</xsl:param>
|
||||
<xsl:param name="fop1.extensions">1</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Paper & Page Size
|
||||
################################################### -->
|
||||
|
||||
<!-- Paper type, no headers on blank pages, no double sided printing -->
|
||||
<xsl:param name="double.sided">0</xsl:param>
|
||||
<xsl:param name="headers.on.blank.pages">0</xsl:param>
|
||||
<xsl:param name="footers.on.blank.pages">0</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Fonts & Styles
|
||||
################################################### -->
|
||||
|
||||
<xsl:param name="hyphenate">false</xsl:param>
|
||||
|
||||
<!-- Default Font size -->
|
||||
<xsl:param name="body.font.master">11</xsl:param>
|
||||
<xsl:param name="body.font.small">8</xsl:param>
|
||||
|
||||
<!-- Line height in body text -->
|
||||
<xsl:param name="line-height">1.4</xsl:param>
|
||||
|
||||
<!-- Chapter title size -->
|
||||
<xsl:attribute-set name="chapter.titlepage.recto.style">
|
||||
<xsl:attribute name="text-align">left</xsl:attribute>
|
||||
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.8"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
|
||||
Let's remove it, so this sucker can use our attribute-set only... -->
|
||||
<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
|
||||
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xsl:use-attribute-sets="chapter.titlepage.recto.style">
|
||||
<xsl:call-template name="component.title">
|
||||
<xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
|
||||
</xsl:call-template>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
|
||||
<xsl:attribute-set name="section.title.level1.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.5"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:attribute-set name="section.title.level2.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.25"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:attribute-set name="section.title.level3.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 1.0"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
<xsl:attribute-set name="section.title.level4.properties">
|
||||
<xsl:attribute name="space-before.optimum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.3em</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master * 0.9"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Use code syntax highlighting -->
|
||||
<xsl:param name="highlight.source" select="1"/>
|
||||
<xsl:param name="highlight.default.language" select="xml" />
|
||||
|
||||
<xsl:template match='xslthl:keyword'>
|
||||
<fo:inline font-weight="bold" color="#7F0055"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:comment'>
|
||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:oneline-comment'>
|
||||
<fo:inline font-style="italic" color="#3F5F5F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:multiline-comment'>
|
||||
<fo:inline font-style="italic" color="#3F5FBF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:tag'>
|
||||
<fo:inline color="#3F7F7F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:attribute'>
|
||||
<fo:inline color="#7F007F"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:value'>
|
||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match='xslthl:string'>
|
||||
<fo:inline color="#2A00FF"><xsl:apply-templates/></fo:inline>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--###################################################
|
||||
Tables
|
||||
################################################### -->
|
||||
|
||||
<!-- Some padding inside tables -->
|
||||
<xsl:attribute-set name="table.cell.padding">
|
||||
<xsl:attribute name="padding-left">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">4pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">4pt</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Only hairlines as frame and cell borders in tables -->
|
||||
<xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
|
||||
<xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Labels
|
||||
################################################### -->
|
||||
|
||||
<!-- Label Chapters and Sections (numbering) -->
|
||||
<xsl:param name="chapter.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.autolabel.max.depth" select="1"/>
|
||||
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
<xsl:param name="table.footnote.number.format" select="'1'"/>
|
||||
|
||||
<!--###################################################
|
||||
Programlistings
|
||||
################################################### -->
|
||||
|
||||
<!-- Verbatim text formatting (programlistings) -->
|
||||
<xsl:attribute-set name="monospace.verbatim.properties">
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.small * 1.0"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="verbatim.properties">
|
||||
<xsl:attribute name="space-before.minimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
|
||||
<xsl:attribute name="border-color">#444444</xsl:attribute>
|
||||
<xsl:attribute name="border-style">solid</xsl:attribute>
|
||||
<xsl:attribute name="border-width">0.1pt</xsl:attribute>
|
||||
<xsl:attribute name="padding-top">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-right">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-left">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="margin-right">0.5em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!-- Shade (background) programlistings -->
|
||||
<xsl:param name="shade.verbatim">1</xsl:param>
|
||||
<xsl:attribute-set name="shade.verbatim.style">
|
||||
<xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="list.block.spacing">
|
||||
<xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<xsl:attribute-set name="example.properties">
|
||||
<xsl:attribute name="space-before.minimum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.5em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="keep-together.within-column">always</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Title information for Figures, Examples etc.
|
||||
################################################### -->
|
||||
|
||||
<xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
|
||||
<xsl:attribute name="font-weight">normal</xsl:attribute>
|
||||
<xsl:attribute name="font-style">italic</xsl:attribute>
|
||||
<xsl:attribute name="font-size">
|
||||
<xsl:value-of select="$body.font.master"/>
|
||||
<xsl:text>pt</xsl:text>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="hyphenate">false</xsl:attribute>
|
||||
<xsl:attribute name="space-before.minimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.optimum">0.1em</xsl:attribute>
|
||||
<xsl:attribute name="space-before.maximum">0.1em</xsl:attribute>
|
||||
</xsl:attribute-set>
|
||||
|
||||
<!--###################################################
|
||||
Callouts
|
||||
################################################### -->
|
||||
|
||||
<!-- don't use images for callouts -->
|
||||
<xsl:param name="callout.graphics">0</xsl:param>
|
||||
<xsl:param name="callout.unicode">1</xsl:param>
|
||||
|
||||
<!-- Place callout marks at this column in annotated areas -->
|
||||
<xsl:param name="callout.defaultcolumn">90</xsl:param>
|
||||
|
||||
<!--###################################################
|
||||
Misc
|
||||
################################################### -->
|
||||
|
||||
<!-- Placement of titles -->
|
||||
<xsl:param name="formal.title.placement">
|
||||
figure after
|
||||
example after
|
||||
equation before
|
||||
table before
|
||||
procedure before
|
||||
</xsl:param>
|
||||
|
||||
<!-- Format Variable Lists as Blocks (prevents horizontal overflow) -->
|
||||
<xsl:param name="variablelist.as.blocks">1</xsl:param>
|
||||
|
||||
<xsl:param name="body.start.indent">0pt</xsl:param>
|
||||
|
||||
<!-- Show only Sections up to level 3 in the TOCs -->
|
||||
<xsl:param name="toc.section.depth">3</xsl:param>
|
||||
|
||||
<!-- Remove "Chapter" from the Chapter titles... -->
|
||||
<xsl:param name="local.l10n.xml" select="document('')"/>
|
||||
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
|
||||
<l:l10n language="en">
|
||||
<l:context name="title-numbered">
|
||||
<l:template name="chapter" text="%n. %t"/>
|
||||
<l:template name="section" text="%n %t"/>
|
||||
</l:context>
|
||||
<l:context name="title">
|
||||
<l:template name="example" text="Example %n %t"/>
|
||||
</l:context>
|
||||
</l:l10n>
|
||||
</l:i18n>
|
||||
|
||||
<!--###################################################
|
||||
colored and hyphenated links
|
||||
################################################### -->
|
||||
<!--
|
||||
<xsl:template match="ulink">
|
||||
<fo:basic-link external-destination="{@url}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
<xsl:value-of select="@url"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="link">
|
||||
<fo:basic-link internal-destination="{@linkend}"
|
||||
xsl:use-attribute-sets="xref.properties"
|
||||
text-decoration="underline"
|
||||
color="blue">
|
||||
<xsl:choose>
|
||||
<xsl:when test="count(child::node())=0">
|
||||
<xsl:value-of select="@linkend"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fo:basic-link>
|
||||
</xsl:template>
|
||||
-->
|
||||
</xsl:stylesheet>
|
||||