Skip to content

Commit

Permalink
DATAJPA-3 - Initial port of Hades reference documentation.
Browse files Browse the repository at this point in the history
- created Docbook setup (copied from Document project)
- split up Hades documentation into parts and left out what's currently not relevant (extensions, IDE plugin)
- removed sample application part for now
- clearly separated documentation of the general repository implementation from JPA specifics (use the one from Spring Data Commons)
- extracted general namespace configuration into Spring Data Commons
- updated project metadata (repositories, source repo, homepage)
  • Loading branch information
odrotbohm committed Feb 9, 2011
1 parent a005f0b commit 8d2845c
Show file tree
Hide file tree
Showing 62 changed files with 3,821 additions and 0 deletions.
59 changes: 59 additions & 0 deletions pom.xml
Expand Up @@ -168,6 +168,65 @@
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>com.agilejava.docbkx</groupId>
<artifactId>docbkx-maven-plugin</artifactId>
<version>2.0.7</version>
<executions>
<execution>
<goals>
<goal>generate-html</goal>
<goal>generate-pdf</goal>
</goals>
<phase>pre-site</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.docbook</groupId>
<artifactId>docbook-xml</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<includes>index.xml</includes>
<xincludeSupported>true</xincludeSupported>
<foCustomization>${project.basedir}/src/docbkx/resources/xsl/fopdf.xsl</foCustomization>
<htmlStylesheet>css/html.css</htmlStylesheet>
<chunkedOutput>false</chunkedOutput>
<htmlCustomization>${project.basedir}/src/docbkx/resources/xsl/html.xsl</htmlCustomization>
<useExtensions>1</useExtensions>
<highlightSource>1</highlightSource>
<highlightDefaultLanguage></highlightDefaultLanguage>
<!-- callouts -->
<entities>
<entity>
<name>version</name>
<value>${pom.version}</value>
</entity>
</entities>
<postProcess>
<copy todir="${project.basedir}/target/site/reference">
<fileset dir="${project.basedir}/target/docbkx">
<include name="**/*.html" />
<include name="**/*.pdf" />
</fileset>
</copy>
<copy todir="${project.basedir}/target/site/reference/html">
<fileset dir="${project.basedir}/src/docbkx/resources">
<include name="**/*.css" />
<include name="**/*.png" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
</fileset>
</copy>
<move file="${project.basedir}/target/site/reference/pdf/index.pdf"
tofile="${project.basedir}/target/site/reference/pdf/${project.artifactId}-reference.pdf"
failonerror="false" />
</postProcess>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
92 changes: 92 additions & 0 deletions src/docbkx/appendix/faq.xml
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<appendix id="faq">
<title>Frequently asked questions</title>

<qandaset>
<qandadiv>
<title>Common</title>

<qandaentry>
<question>
<para>I'd like to get more detailled logging information on what
methods are called inside
<interfacename>JpaRepository</interfacename>, e.g. How can I gain
them?</para>
</question>

<answer>
<para>You can make use of
<classname>CustomizableTraceInterceptor</classname> provided by
Spring:</para>

<programlisting language="xml">&lt;bean id="customizableTraceInterceptor" class="
org.springframework.aop.interceptor.CustomizableTraceInterceptor"&gt;
&lt;property name="enterMessage" value="Entering $[methodName]($[arguments])"/&gt;
&lt;property name="exitMessage" value="Leaving $[methodName](): $[returnValue]"/&gt;
&lt;/bean&gt;

&lt;aop:config&gt;
&lt;aop:advisor advice-ref="customizableTraceInterceptor"
pointcut="execution(public * org.sfw.data.jpa.repository.JpaRepository+.*(..))"/&gt;
&lt;/aop:config&gt;</programlisting>
</answer>
</qandaentry>
</qandadiv>

<qandadiv>
<title>Infrastructure</title>

<qandaentry>
<question>
<para>Currently I have implemented a repository layer based on
<classname>HibernateDaoSupport</classname>. I create a
<classname>SessionFactory</classname> by using Spring's
<classname>AnnotationSessionFactoryBean</classname>. How do I get
Hades DAOs working in this environment.</para>
</question>

<answer>
<para>You have to replace
<classname>AnnotationSessionFactoryBean</classname> with the
<classname>LocalContainerEntityManagerFactoryBean</classname>.
Supposed you have registered it under
<code>entityManagerFactory</code> you can reference it in you
repositories based on <classname>HibernateDaoSupport</classname> as
follows:</para>

<example>
<title>Looking up a SessionFactory from an
HibernateEntityManagerFactory</title>

<programlisting language="xml">&lt;bean class="com.acme.YourDaoBasedOnHibernateDaoSupport"&gt;
&lt;property name="sessionFactory"&gt;
&lt;bean factory-bean="entityManagerFactory"
factory-method="getSessionFactory" /&gt;
&lt;/property&gt;
&lt;/bean&gt;</programlisting>
</example>
</answer>
</qandaentry>
</qandadiv>

<qandadiv>
<title>Auditing</title>

<qandaentry>
<question>
<para>I want to use Spring Data JPA auditing capabilities but have
my database already set up to set modification and creation date on
entities. How to prevent Hades to set the date
programmatically.</para>
</question>

<answer>
<para>Just use the <code>set-dates</code> attribute of the
<code>auditing</code> namespace element to false.</para>
</answer>
</qandaentry>
</qandadiv>
</qandaset>
</appendix>
114 changes: 114 additions & 0 deletions src/docbkx/appendix/glossary.xml
@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<glossary id="glossary">
<glossdiv>
<title>A</title>

<glossentry>
<glossterm>AOP</glossterm>

<glossdef>
<para>Aspect oriented programming</para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>C</title>

<glossentry>
<glossterm>Commons DBCP</glossterm>

<glossdef>
<para>Commons DataBase Connection Pools - Library of the Apache
foundation offering pooling implementations of the
<interfacename>DataSource</interfacename> interface.</para>
</glossdef>
</glossentry>

<glossentry>
<glossterm>CRUD</glossterm>

<glossdef>
<para>Create, Read, Update, Delete - Basic persistence
operations</para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>D</title>

<glossentry>
<glossterm>DAO</glossterm>

<glossdef>
<para>Data Access Object - Pattern to separate persisting logic from
the object to be persisted</para>
</glossdef>
</glossentry>

<glossentry>
<glossterm>Dependency Injection</glossterm>

<glossdef>
<para>Pattern to hand a component's dependency to the component from
outside, freeing the component to lookup the dependant itself. For
more information see <ulink
url="http://en.wikipedia.org/wiki/Dependency_Injection">http://en.wikipedia.org/wiki/Dependency_Injection</ulink>.</para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>E</title>

<glossentry>
<glossterm>EclipseLink</glossterm>

<glossdef>
<para>Object relational mapper implementing JPA - <ulink
url="http://www.eclipselink.org">http://www.eclipselink.org</ulink></para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>H</title>

<glossentry>
<glossterm>Hibernate</glossterm>

<glossdef>
<para>Object relational mapper implementing JPA - <ulink
url="http://www.hibernate.org">http://www.hibernate.org</ulink></para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>J</title>

<glossentry>
<glossterm>JPA</glossterm>

<glossdef>
<para>Java Persistence Api</para>
</glossdef>
</glossentry>
</glossdiv>

<glossdiv>
<title>S</title>

<glossentry>
<glossterm>Spring</glossterm>

<glossdef>
<para>Java application framework - <ulink
url="http://www.springframework.org">http://www.springframework.org</ulink></para>
</glossdef>
</glossentry>
</glossdiv>
</glossary>
77 changes: 77 additions & 0 deletions src/docbkx/index.xml
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<book xmlns:xi="http://www.w3.org/2001/XInclude">
<bookinfo>
<title>Spring Data JPA - Reference Documentation</title>

<releaseinfo>1.0.0.BUILD-SNAPSHOT</releaseinfo>

<authorgroup>
<author>
<firstname>Oliver</firstname>

<surname>Gierke</surname>

<affiliation>
<jobtitle>Senior Consultant</jobtitle>

<orgname>SpringSource - a division of VMware</orgname>
</affiliation>

<email>ogierke@vmware.com</email>
</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>

<pubdate />

<copyright>
<year>2008-2011</year>

<holder>The original authors</holder>
</copyright>

<revhistory>
<revision>
<date>09.02.2011</date>

<author>
<firstname>Oliver</firstname>

<surname>Gierke</surname>
</author>

<revremark>Initial port from Hades documentation</revremark>
</revision>
</revhistory>
</bookinfo>

<toc />

<xi:include href="preface.xml" />

<part id="reference">
<title>Reference Documentation</title>

<xi:include href="https://github.com/SpringSource/spring-data-commons/raw/master/src/docbkx/repositories.xml" />

<xi:include href="reference/jpa.xml" />
</part>

<part id="appendix">
<title>Appendix</title>

<xi:include href="https://github.com/SpringSource/spring-data-commons/raw/master/src/docbkx/repository-namespace-reference.xml" />

<xi:include href="appendix/faq.xml" />

<xi:include href="appendix/glossary.xml" />
</part>
</book>
38 changes: 38 additions & 0 deletions src/docbkx/preface.xml
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
<preface id="preface">
<title>Preface</title>

<section id="project">
<title>Project metadata</title>

<itemizedlist spacing="compact">
<listitem>
<para>Version control - <ulink
url="http://git.synyx.org/hades.git">git://github.com/SpringSource/spring-data-jpa.git</ulink></para>
</listitem>

<listitem>
<para>Bugtracker - <ulink
url="http://hades.synyx.org">https://jira.springsource.org/browse/DATAJPA</ulink></para>
</listitem>

<listitem>
<para>Release repository - <ulink
url="http://repo2.maven.org/maven2/org/synyx/hades"><ulink
url="http://maven.springframework.org/release">http://maven.springframework.org/release</ulink></ulink></para>
</listitem>

<listitem>
<para>Milestone repsitory - <ulink
url="http://maven.springframework.org/milestone">http://maven.springframework.org/milestone</ulink></para>
</listitem>

<listitem>
<para>Snapshot repsitory - <ulink
url="http://maven.springframework.org/snapshot">http://maven.springframework.org/snapshot</ulink></para>
</listitem>
</itemizedlist>
</section>
</preface>

0 comments on commit 8d2845c

Please sign in to comment.