You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2018/01/05 14:21:29 UTC

[01/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Repository: cayenne
Updated Branches:
  refs/heads/STABLE-3.1 4cc7a6eec -> 7783cd34a


http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/src/docbkx/new-features.xml b/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
deleted file mode 100644
index 3251d5d..0000000
--- a/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?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.
--->
-<article xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Guide to 3.1 Features</title>
-    <para>This guide highlights the new features and changes introduced in 3.1 release. It is a
-        high-level overview. For more details consult <emphasis role="bold"
-            >RELEASE-NOTES.txt</emphasis> file included in each release for the full list of
-        changes, and <emphasis role="bold">UPGRADE.txt</emphasis> for the release-specific upgrade
-        instructions.</para>
-    <section xml:id="ditribution-content-structure">
-        <title>Distribution Contents Structure</title>
-        <para>Cayenne distribution is made leaner and more modular:</para>
-        <itemizedlist>
-            <listitem>
-                <para>"cayenne-modeler.jar" is no longer included in the "lib" folder, as it is no
-                    longer used for loading local JNDI overrides. Of course "CayenneModeler-the-app"
-                    is still included.</para>
-            </listitem>
-            <listitem>
-                <para>Ashwood library used for commit operation sorting is no longer a third-party
-                    dependency. Instead a small subset of the relevant Ashwood classes got included
-                    in Cayenne core.</para>
-            </listitem>
-            <listitem>
-                <para>The following helper modules are split away from Cayenne core:
-                    "cayenne-project" and "cayenne-wocompat". They are bundled in CayenneModeler,
-                    and are available from the source distribution. They are not included as
-                    standalone jars in the binary distribution.</para>
-            </listitem>
-        </itemizedlist>
-    </section>
-    <section xml:id="cayenne-configuration">
-        <title>Cayenne Configuration</title>
-        
-        <note><para>The new DI-based bootstrap and configuration
-            approach is not API-compatible with earlier versions of Cayenne. Make sure
-            you read the UPGRADE.txt file for instructions how to upgrade the existing
-            projects.</para></note>
-        <section>
-            <title>Dependency Injection Container</title>
-            <para>Cayenne 3.1 runtime stack is built around the ideas of Dependency Injection (DI),
-                making it extremely flexible and easy to extend. It bundles a small, flexible
-                annotations-based DI container to configure its services. The container provides DI
-                services and exposes Cayenne extension points, but does not interfere with other DI
-                containers that may be present in the application. I.e. it is invisible to the users
-                who do not care about advanced Cayenne customization.</para>
-        </section>
-        <section>
-            <title>Bootstrapping Cayenne in Various Environments</title>
-            <para> Here is a simple example of starting a server-side Cayenne stack:</para>
-            <programlisting language="java">ServerRuntime runtime = new ServerRuntime("cayenne-UntitledDomain.xml");</programlisting>
-            <para>For more detailed examples check the tutorials and other documentation.</para>
-        </section>
-        <section>
-            <title>Configuring Local DataSources, Removal of JNDI Hack</title>
-            <para>Cayenne 3.1 provides a property-based mechanism to override Modeler DataSource
-                definitions, regardless of whether they are driver configurations, JNDI, DBCP, etc.
-                A quick configuration example is shown below:</para>
-            <programlisting>-Dcayenne.jdbc.driver=com.mysql.jdbc.Driver -Dcayenne.jdbc.url=jdbc:mysql://localhost/mydb \
--Dcayenne.jdbc.username=user -Dcayenne.jdbc.password=password</programlisting>
-            <para>For more details and configuration options see javadocs of
-                org.apache.cayenne.configuration.server.PropertyDataSourceFactory. </para>
-            <para>This feature supersedes what was formerly known as "JNDI hack", i.e. JNDI
-                DataSource failover load strategy based on CayenneModeler preferences database. The
-                problem with JNDI hack was unstable and frequently corrupted preferences database,
-                and the need to include hsqldb and cayenne-modeler jars in the runtime. </para>
-        </section>
-    </section>
-    <section xml:id="framework-api">
-        <title>Framework API</title>
-        <para>
-            <emphasis role="italic">See UPGRADE.txt for the full list of changes</emphasis>
-        </para>
-        <section>
-            <title>Lifecycle Listener Annotations</title>
-            <para>Cayenne 3.1 features support for annotations on lifecycle listeners (but not yet
-                on entity callback methods) that simplifies registering listeners via API. Our
-                experience with Cayenne 3.0 shows that mapping listeners in the Modeler doesn't
-                scale well to complex applications, and 3.0 API for mapping the listeners is hard to
-                use. In 3.1 you can annotate listener methods and register multiple callback methods
-                with a single call. </para>
-            <programlisting language="java">// declare a listener with annotated methods
-class MyListener {
-    @PostLoad(Entity1.class)
-    @PostPersist(Entity1.class)
-    void postLoad(Object object) {
-        ....
-    }
-}
-
-// register a listener
-ServerRuntime runtime = ..
-MyListener listener = new MyListener();
-runtime.getChannel().getEntityResolver().getCallbackRegistry().addListener(listener);</programlisting>
-            <para>Moreover, unlike JPA annotations, Cayenne allows to attach a listener to a set of
-                entities not known to the listener upfront, but that are all annotated with some
-                custom annotation:</para>
-            <programlisting language="java">class MyListener {
-    @PostLoad(entityAnnotations = CustomAnnotation.class)
-    void postLoad(Object object) {
-        ....
-    }
-}</programlisting>
-        </section>
-        <section>
-            <title>DataChannelFilter for Intercepting DataDomain Operations</title>
-            <para>Cayenne now features a DataChannelFilter interface that allows to intercept and
-                alter all DataChannel traffic (i.e. selects and commits between a DataContext and
-                DataDomain). It provides a chain of command API very similar to servlet filters.
-                Filters are widely used by "cayenne-lifecyle" extensions and allow to build powerful
-                custom object lifecycle-aware code. To install a filter, the following API is
-                used:</para>
-            <programlisting language="java">class MyFilter implement DataChannelFilter { .. }
-
-MyFilter filter = new MyFilter();
-ServerRuntime runtime = ..
-runtime.getDataDomain().addFilter(filter);</programlisting>
-            <para>Very often filters mark some of their own methods with lifecycle annotations so
-                that certain operations can be triggered by Cayenne inside the scope of filter's
-                onQuery() or onSync() methods. To ensure annotated methods are invoked, filter
-                registration should be combined with listener registration:</para>
-            <programlisting language="java">MyFilter filter = new MyFilter();
-ServerRuntime runtime = ..
-runtime.getDataDomain().addFilter(filter);
-runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(filter);
-// noticed that by default runtime.getDataDomain() is equivalent to runtime.getChannel()</programlisting>
-        </section>
-    </section>
-    <section xml:id="cayenne-modeler">
-        <title>CayenneModeler</title>
-        <section>
-            <title>Java Preferences API</title>
-            <para>We got rid of HSQLDB-based preferences storage, and are using standard Java
-                Preferences API for the Modeler preferences. This solved a long-standing stability
-                issue with Modeler preferences. So no more lost user preferences.</para>
-        </section>
-    </section>
-    <section xml:id="lifecycle-extensions">
-        <title>Lifecycle Extensions</title>
-        <para>Cayenne 3.1 includes an optional cayenne-lifecyle module that implements a few useful
-            extensions based on DataChannelFilters and lifecycle annotations. Those include a
-            concept of a String ID (which is a String URL-friendly representation of ObjectId),
-            support for (de)referencing objects by String ID, String ID-based relationships,
-            annotation-based cache groups invalidation, annotation-based audit of object changes,
-            etc.</para>
-    </section>
-</article>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/upgrade-guide/src/images/.gitignore
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/src/images/.gitignore b/docs/docbook/upgrade-guide/src/images/.gitignore
deleted file mode 100644
index 126477b..0000000
--- a/docs/docbook/upgrade-guide/src/images/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# keeping this here to ensure the empty folder is present
-# it is expected by a shared docbook plugin config

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/pom.xml
----------------------------------------------------------------------
diff --git a/docs/pom.xml b/docs/pom.xml
index 8e76392..167c2da 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -35,7 +35,7 @@
 
 	<modules>
 		<module>doc</module>
-		<module>docbook</module>
+		<module>asciidoc</module>
 	</modules>
 
 	<build>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
index 7fde457..24daec6 100644
--- a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
+++ b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/Main.java
@@ -52,11 +52,14 @@ public class Main {
 	static void newObjectsTutorial(ObjectContext context) {
 
 		// creating new Artist
+		// tag::new-artist[]
 		Artist picasso = context.newObject(Artist.class);
 		picasso.setName("Pablo Picasso");
 		picasso.setDateOfBirthString("18811025");
+		// end::new-artist[]
 
 		// Creating other objects
+		// tag::new-painting[]
 		Gallery metropolitan = context.newObject(Gallery.class);
 		metropolitan.setName("Metropolitan Museum of Art");
 
@@ -65,16 +68,21 @@ public class Main {
 
 		Painting stein = context.newObject(Painting.class);
 		stein.setName("Gertrude Stein");
+		// end::new-painting[]
 
 		// connecting objects together via relationships
+		// tag::link-objects[]
 		picasso.addToPaintings(girl);
 		picasso.addToPaintings(stein);
 
 		girl.setGallery(metropolitan);
 		stein.setGallery(metropolitan);
+		// end::link-objects[]
 
 		// saving all the changes above
+		// tag::commit[]
 		context.commitChanges();
+		// end::commit[]
 	}
 
 	static void selectTutorial(ObjectContext context) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
index 8846edc..d9f8cf7 100644
--- a/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
+++ b/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial/persistent/Artist.java
@@ -24,6 +24,7 @@ import java.util.Date;
 
 import org.apache.cayenne.tutorial.persistent.auto._Artist;
 
+// tag::content[]
 public class Artist extends _Artist {
 
 	static final String DEFAULT_DATE_FORMAT = "yyyyMMdd";
@@ -50,3 +51,4 @@ public class Artist extends _Artist {
 		}
 	}
 }
+// end::content[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/tutorials/tutorial/src/main/webapp/detail.jsp
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/webapp/detail.jsp b/tutorials/tutorial/src/main/webapp/detail.jsp
index d031a8d..7e87096 100644
--- a/tutorials/tutorial/src/main/webapp/detail.jsp
+++ b/tutorials/tutorial/src/main/webapp/detail.jsp
@@ -24,6 +24,7 @@
 <%@ page import="java.util.*" %>
 <%@ page import="java.text.*" %>
 
+// tag::content[]
 <% 
     ObjectContext context = BaseContext.getThreadObjectContext();
     String id = request.getParameter("id");
@@ -84,4 +85,5 @@
             </table>
         </form>
     </body>	
-</html>
\ No newline at end of file
+</html>
+// end::content[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/tutorials/tutorial/src/main/webapp/index.jsp
----------------------------------------------------------------------
diff --git a/tutorials/tutorial/src/main/webapp/index.jsp b/tutorials/tutorial/src/main/webapp/index.jsp
index da44af1..5876fe4 100644
--- a/tutorials/tutorial/src/main/webapp/index.jsp
+++ b/tutorials/tutorial/src/main/webapp/index.jsp
@@ -25,6 +25,7 @@
 <%@ page import="org.apache.cayenne.exp.*" %>
 <%@ page import="java.util.*" %>
 
+// tag::content[]
 <% 
     SelectQuery query = new SelectQuery(Artist.class);
     query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);
@@ -51,4 +52,5 @@
         <hr>
         <p><a href="detail.jsp">Create new artist...</a></p>
     </body>	
-</html>
\ No newline at end of file
+</html>
+// end::content[]
\ No newline at end of file


[10/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/expressions.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/expressions.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/expressions.adoc
new file mode 100644
index 0000000..74b836a
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/expressions.adoc
@@ -0,0 +1,244 @@
+// 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.
+[[expressions]]
+=== Expressions
+
+==== Expressions Overview
+
+Cayenne provides a simple yet powerful object-based expression language. The most common use of expressions are to build qualifiers and orderings of queries that are later converted to SQL by Cayenne and to evaluate in-memory against specific objects (to access certain values in the object graph or to perform in-memory object filtering and sorting). Cayenne provides API to build expressions in the code and a parser to create expressions from strings.
+
+==== Path Expressions
+
+Before discussing how to build expressions, it is important to understand one group of expressions widely used in Cayenne - path expressions. There are two types of path expressions - object and database, used for navigating graphs of connected objects or joined DB tables respectively. Object paths are much more commonly used, as after all Cayenne is supposed to provide a degree of isolation of the object model from the database. However database paths are helpful in certain situations. General structure of path expressions is the following:
+
+----
+ [db:]segment[+][.segment[+]...]
+----
+
+- `db:` is an optional prefix indicating that the following path is a DB path. Otherwise it is an object path.
+
+- `segment` is a name of a property (relationship or attribute in Cayenne terms) in the path. Path must have at least one segment; segments are separated by dot (".").
+
+- `+` An "OUTER JOIN" path component. Currently "+" only has effect when translated to SQL as OUTER JOIN. When evaluating expressions in memory, it is ignored.
+
+An object path expression represents a chain of property names rooted in a certain (unspecified during expression creation) object and "navigating" to its related value. E.g. a path expression `artist.name` might be a property path starting from a Painting object, pointing to the related Artist object, and then to its name attribute. A few more examples:
+
+- `name` - can be used to navigate (read) the "name" property of a Person (or any other type of object that has a "name" property).
+
+- `artist.exhibits.closingDate` - can be used to navigate to a closing date of any of the exhibits of a Painting's Artist object.
+
+- `artist.exhibits+.closingDate` - same as the previous example, but when translated into SQL, an OUTER JOIN will be used for "exhibits".
+
+Similarly a database path expression is a dot-separated path through DB table joins and columns. In Cayenne joins are mapped as DbRelationships with some symbolic names (the closest concept to DbRelationship name in the DB world is a named foreign key constraint. But DbRelationship names are usually chosen arbitrarily, without regard to constraints naming or even constraints presence). A database path therefore might look like this - `db:dbrelationshipX.dbrelationshipY.COLUMN_Z`. More specific examples:
+
+- `db:NAME` - can be used to navigate to the value of "NAME" column of some unspecified table.
+
+- `db:artist.artistExhibits.exhibit.CLOSING_DATE` - can be used to match a closing date of any of the exhibits of a related artist record.
+
+Cayenne supports "aliases" in path Expressions. E.g. the same expression can be written using explicit path or an alias:
+
+- `artist.exhibits.closingDate` - full path
+
+- `e.closingDate` - alias `e` is used for `artist.exhibits`.
+
+SelectQuery using the second form of the path expression must be made aware of the alias via `SelectQuery.aliasPathSplits(..)`, otherwise an Exception will be thrown. The main use of aliases is to allow users to control how SQL joins are generated if the same path is encountered more than once in any given Expression. Each alias for any given path would result in a separate join. Without aliases, a single join will be used for a group of matching paths.
+
+==== Creating Expressions from Strings
+
+While in most cases users are likely to rely on API from the following section for expression creation, we'll start by showing String expressions, as this will help to understand the semantics. A Cayenne expression can be represented as a String, which can be converted to an expression object using `ExpressionFactory.exp` static method. Here is an example:
+
+
+[source, java]
+----
+String expString = "name like 'A%' and price < 1000";
+Expression exp = ExpressionFactory.exp(expString);
+----
+
+This particular expression may be used to match Paintings whose names that start with "A" and whose price is less than $1000. While this example is pretty self-explanatory, there are a few points worth mentioning. "name" and "price" here are object paths discussed earlier. As always, paths themselves are not attached to a specific root entity and can be applied to any entity that has similarly named attributes or relationships. So when we are saying that this expression "may be used to match Paintings", we are implying that there may be other entities, for which this expression is valid. Now the expression details...
+
+Character constants that are not paths or numeric values should be enclosed in single or double quotes. Two of the expressions below are equivalent:
+
+[source, java]
+----
+name = 'ABC'
+
+// double quotes are escaped inside Java Strings of course
+name = \"ABC\"
+----
+
+Case sensitivity. Expression operators are case sensitive and are usually lowercase. Complex words follow the Java camel-case style:
+
+[source, java]
+----
+// valid
+name likeIgnoreCase 'A%'
+
+// invalid - will throw a parse exception
+name LIKEIGNORECASE 'A%'
+----
+
+Grouping with parenthesis:
+
+
+[source, java]
+----
+value = (price + 250.00) * 3
+----
+
+Path prefixes. Object expressions are unquoted strings, optionally prefixed by `obj:` (usually they are not prefixed at all actually). Database expressions are always prefixed with `db:`. A special kind of prefix, not discussed yet is `enum:` that prefixes an enumeration constant:
+
+[source, java]
+----
+// object path
+name = 'Salvador Dali'
+
+// same object path - a rarely used form
+obj:name = 'Salvador Dali'
+
+// multi-segment object path
+artist.name = 'Salvador Dali'
+
+// db path
+db:NAME = 'Salvador Dali'
+
+// enumeration constant
+name = enum:org.foo.EnumClass.VALUE1
+----
+
+Binary conditions are expressions that contain a path on the left, a value on the right, and some operation between them, such as equals, like, etc. They can be used as qualifiers in SelectQueries:
+
+[source, java]
+----
+name like 'A%'
+----
+
+
+Named parameters. Expressions can have named parameters (names that start with "$"). Parameterized expressions allow to create reusable expression templates. Also if an Expression contains a complex object that doesn't have a simple String representation (e.g. a Date, a DataObject, an ObjectId), parameterizing such expression is the only way to represent it as String. Here are some examples:
+
+
+[source, java]
+----
+Expression template = Expression.fromString("name = $name");
+...
+Map p1 = Collections.singletonMap("name", "Salvador Dali");
+Expression qualifier1 = template.expWithParameters(p1);
+...
+Map p2 = Collections.singletonMap("name", "Monet");
+Expression qualifier2 = template.expWithParameters(p2);
+----
+
+To create a named parameterized expression with a LIKE clause, SQL wildcards must be part of the values in the Map and not the expression string itself:
+
+[source, java]
+----
+Expression template = Expression.fromString("name like $name");
+...
+Map p1 = Collections.singletonMap("name", "Salvador%");
+Expression qualifier1 = template.expWithParameters(p1);
+----
+
+When matching on a relationship, parameters can be Persistent objects or ObjectIds:
+
+[source, java]
+----
+Expression template = Expression.fromString("artist = $artist");
+...
+Artist dali = // asume we fetched this one already
+Map p1 = Collections.singletonMap("artist", dali);
+Expression qualifier1 = template.expWithParameters(p1);
+----
+
+Uninitialized parameters will be automatically pruned from expressions, so a user can omit some parameters when creating an expression from a parameterized template:
+
+[source, java]
+----
+Expression template = Expression.fromString("name like $name and dateOfBirth > $date");
+...
+Map p1 = Collections.singletonMap("name", "Salvador%");
+Expression qualifier1 = template.expWithParameters(p1);
+
+// qualifier1 is now equals to "name like 'Salvador%'", the 'dateOfBirth' condition was
+// pruned, as no value was specified for the $date parameter
+----
+
+Null handling. Handling of Java nulls as operands is no different from normal values. Instead of using special conditional operators, like SQL does (IS NULL, IS NOT NULL), "=" and "!=" expressions are used directly with null values. It is up to Cayenne to translate expressions with nulls to the valid SQL.
+
+
+NOTE: A formal definition of all possible valid expressions in a form of JavaCC grammar is provided in Appendix C
+
+==== Creating Expressions via API
+
+Creating expressions from Strings is a powerful and dynamic approach, however a safer alternative is to use Java API. It provides some degree of compile-time checking of expressions validity. The API is cenetred around ExpressionFactory class, and the Expression class. ExpressionFactory contains a number of rather self-explanatory factory methods. We won't be going over all of them in detail, but will rather show a few general examples and some gotchas.
+
+The following code recreates the expression from the previous chapter, but now using expression API:
+
+[source, java]
+----
+// String expression: name like 'A%' and price < 1000
+Expression e1 = ExpressionFactory.likeExp("name", "A%");
+Expression e2 = ExpressionFactory.lessExp("price", 1000);
+Expression finalExp = e1.andExp(e2);
+----
+
+This is more verbose than creating it from String, but it is also more resilient to the entity properties renaming and precludes semantic errors in the expression String.
+
+NOTE: The last line in the example above shows how to create a new expression by "chaining" two other epxressions. A common error when chaining expressions is to assume that "andExp" and "orExp" append another expression to the current expression. In fact a new expression is created. I.e. Expression API treats existing expressions as immutable.
+
+As discussed earlier, Cayenne supports aliases in path Expressions, allowing to control how SQL joins are generated if the same path is encountered more than once in the same Expression. Two ExpressionFactory methods allow to implicitly generate aliases to "split" match paths into individual joins if needed:
+
+[source, java]
+----
+Expression matchAllExp(String path, Collection values)
+Expression matchAllExp(String path, Object... values)
+----
+
+"Path" argument to both of these methods can use a split character (a pipe symbol '|') instead of dot to indicate that relationship following a path should be split into a separate set of joins, one per collection value. There can only be one split at most in any given path. Split must always precede a relationship. E.g. `|exhibits.paintings`, `exhibits|paintings`, etc. Internally Cayenne would generate distinct aliases for each of the split expressions, forcing separate joins.
+
+[[evaluete]]
+==== Evaluating Expressions in Memory
+
+When used in a query, an expression is converted to SQL WHERE clause (or ORDER BY clause) by Cayenne during query execution. Thus the actual evaluation against the data is done by the database engine. However the same expressions can also be used for accessing object properties, calculating values, in-memory filtering.
+
+
+Checking whether an object satisfies an expression:
+
+[source, java]
+----
+Expression e = Artist.NAME.in("John", "Bob");
+Artist artist = ...
+if(e.match(artist)) {
+   ...
+}
+----
+
+Reading property value:
+
+
+[source, java]
+----
+Expression e = Expression.fromString(User.NAME_PROPERTY);
+String name = e.evaluate(user);
+----
+
+Filtering a list of objects:
+
+[source, java]
+----
+Expression e = Artist.NAME.in("John", "Bob");
+List<Artist> unfiltered = ...
+List<Artist> filtered = e.filterObjects(unfiltered);
+----
+
+
+NOTE: Current limitation of in-memory expressions is that no collections are permitted in the property path.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
new file mode 100644
index 0000000..2999375
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/including.adoc
@@ -0,0 +1,394 @@
+// 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.
+
+include::../var.adoc[]
+
+[[include]]
+=== Including Cayenne in a Project
+
+==== Jar Files and Dependencies
+
+Cayenne distribution contains the following core runtime jars in the distribution lib directory:
+
+- `cayenne-server-x.x.jar` - contains full Cayenne runtime (DI, adapters, DB access classes, etc.). Most applications will use only this file.
+
+- `cayenne-client-x.x.jar` - a subset of cayenne-server.jar trimmed for use on the client in an ROP application.
+
+- Other `cayenne-* jars` - various Cayenne extensions.
+
+When using `cayenne-server-x.x.jar` you'll need a few third party jars (all included in `lib/third-party` directory of the distribution):
+
+- http://velocity.apache.org[Apache Velocity Template Engine], version 1.6.x (and all its dependencies bundled with velocity-dep)
+
+- http://commons.apache.org/proper/commons-collections/[Apache Commons Collections], version 3.2.1
+
+- http://commons.apache.org/proper/commons-logging/[Apache Commons Logging], version 1.1
+
+Cayenne integrates with various caching, clustering and other frameworks. These optional integrations will require other third-party jars that the users will need to obtain on their own.
+
+==== Maven Projects
+
+If you are using Maven, you won't have to deal with figuring out the dependencies. You can simply include cayenne-server artifact in your POM:
+
+[source,xml,subs="verbatim,attributes"]
+----
+<dependency>
+   <groupId>org.apache.cayenne</groupId>
+   <artifactId>cayenne-server</artifactId>
+   <version>{version}</version>
+</dependency>
+----
+
+Additionally Cayenne provides a Maven plugin with a set of goals to perform various project tasks, such as synching generated Java classes with the mapping, described in the following subsection. The full plugin name is `org.apache.cayenne.plugins:cayenne-maven-plugin`.
+
+[[cgen]]
+===== cgen
+
+`cgen` is a `cayenne-maven-plugin` goal that generates and maintains source (.java) files of persistent objects based on a DataMap. By default, it is bound to the generate-sources phase. If "makePairs" is set to "true" (which is the recommended default), this task will generate a pair of classes (superclass/subclass) for each ObjEntity in the DataMap. Superclasses should not be changed manually, since they are always overwritten. Subclasses are never overwritten and may be later customized by the user. If "makePairs" is set to "false", a single class will be generated for each ObjEntity.
+
+By creating custom templates, you can use cgen to generate other output (such as web pages, reports, specialized code templates) based on DataMap information.
+
+[#tablecgen.table.table-bordered]
+.cgen required parameters
+[cols="1,1,4"]
+|===
+|Name |Type|Description
+
+.^|map
+.^|File
+a|DataMap XML file which serves as a source of metadata for class generation. E.g.
+[source]
+----
+${project.basedir}/src/main/resources/my.map.xml
+----
+
+.^|destDir
+.^|File
+a|Root destination directory for Java classes (ignoring their package names).
+|===
+
+
+[#cgenOptional.table.table-bordered]
+.cgen optional parameters
+[cols="2,1,6"]
+|===
+|Name |Type|Description
+
+.^|additionalMaps
+.^|File
+.^|A directory that contains additional DataMap XML files that may be needed to resolve cross-DataMap relationships for the the main DataMap, for which class generation occurs.
+
+.^|client
+.^|boolean
+.^|Whether we are generating classes for the client tier in a Remote Object Persistence application. "False" by default.
+
+.^|embeddableTemplate
+.^|String
+.^|Location of a custom Velocity template file for Embeddable class generation. If omitted, default template is used.
+
+.^|embeddableSuperTemplate
+.^|String
+.^|Location of a custom Velocity template file for Embeddable superclass generation. Ignored unless "makepairs" set to "true". If omitted, default template is used.
+
+.^|encoding
+.^|String
+.^|Generated files encoding if different from the default on current platform. Target encoding must be supported by the JVM running the build. Standard encodings supported by Java on all platforms are US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16. See javadocs for java.nio.charset.Charset for more information.
+
+.^|excludeEntities
+.^|String
+.^|A comma-separated list of ObjEntity patterns (expressed as a perl5 regex) to exclude from template generation. By default none of the DataMap entities are excluded.
+
+.^|includeEntities
+.^|String
+.^|A comma-separated list of ObjEntity patterns (expressed as a perl5 regex) to include from template generation. By default all DataMap entities are included.
+
+.^|makePairs
+.^|boolean
+.^|If "true" (a recommended default), will generate subclass/superclass pairs, with all generated code placed in superclass.
+
+.^|mode
+.^|String
+.^|Specifies class generator iteration target. There are three possible values: "entity" (default), "datamap", "all". "entity" performs one generator iteration for each included ObjEntity, applying either standard to custom entity templates. "datamap" performs a single iteration, applying DataMap templates. "All" is a combination of entity and datamap.
+
+.^|overwrite
+.^|boolean
+.^|Only has effect when "makePairs" is set to "false". If "overwrite" is "true", will overwrite older versions of generated classes.
+
+.^|superPkg
+.^|String
+.^|Java package name of all generated superclasses. If omitted, each superclass will be placed in the subpackage of its subclass called "auto". Doesn't have any effect if either "makepairs" or "usePkgPath" are false (both are true by default).
+
+.^|superTemplate
+.^|String
+.^|Location of a custom Velocity template file for ObjEntity superclass generation. Only has effect if "makepairs" set to "true". If omitted, default template is used.
+
+.^|template
+.^|String
+.^|Location of a custom Velocity template file for ObjEntity class generation. If omitted, default template is used.
+
+.^|usePkgPath
+.^|boolean
+.^|If set to "true" (default), a directory tree will be generated in "destDir" corresponding to the class package structure, if set to "false", classes will be generated in "destDir" ignoring their package.
+
+|===
+
+Example - a typical class generation scenario, where pairs of classes are generated with default Maven source destination and superclass package:
+
+[source,xml,subs="verbatim,attributes"]
+----
+<plugin>
+    <groupId>org.apache.cayenne.plugins</groupId>
+    <artifactId>cayenne-maven-plugin</artifactId>
+    <version>{project-version}</version>
+
+    <!--
+        There's an intermittent problem when using Maven/cgen in Eclipse with  m2eclipse plugin that
+        requires placing "configuration" section at the plugin level, instead of execution
+        level.
+    -->
+    <configuration>
+            <map>${project.basedir}/src/main/resources/my.map.xml</map>
+            <destDir>${project.basedir}/src/main/java</destDir>
+            <superPkg>org.example.model.auto</superPkg>
+    </configuration>
+
+    <executions>
+        <execution>
+            <goals>
+                <goal>cgen</goal>
+            </goals>
+        </execution>
+    </executions>
+</plugin>
+----
+
+===== cdbgen
+
+`cdbgen` is a `cayenne-maven-plugin` goal that drops and/or generates tables in a database on Cayenne DataMap. By default, it is bound to the pre-integration-test phase.
+
+[#cdbgenTable.table.table-bordered]
+.cdbgen required parameters
+[cols="1,1,4"]
+|===
+|Name |Type|Description
+
+.^|map
+.^|File
+a|DataMap XML file which serves as a source of metadata for class generation. E.g.
+[source]
+----
+${project.basedir}/src/main/resources/my.map.xml
+----
+
+.^|driver
+.^|String
+.^|A class of JDBC driver to use for the target database.
+
+.^|url
+.^|String
+.^|JDBC connection URL of a target database.
+|===
+
+[#cdbgenOptionl.table.table-bordered]
+.cdbgen optional parameters
+[cols="1,1,4"]
+|===
+|Name |Type|Description
+
+.^|adapter
+.^|String
+.^|Java class name implementing org.apache.cayenne.dba.DbAdapter. While this attribute is optional (a generic JdbcAdapter is used if not set), it is highly recommended to specify correct target adapter.
+
+
+.^|createFK
+.^|boolean
+.^|Indicates whether cdbgen should create foreign key constraints. Default is "true".
+
+.^|createPK
+.^|boolean
+.^|Indicates whether cdbgen should create Cayenne-specific auto PK objects. Default is "true".
+
+.^|createTables
+.^|boolean
+.^|Indicates whether cdbgen should create new tables. Default is "true".
+
+.^|dropPK
+.^|boolean
+.^|Indicates whether cdbgen should drop Cayenne primary key support objects. Default is "false".
+
+.^|dropTables
+.^|boolean
+.^|Indicates whether cdbgen should drop the tables before attempting to create new ones. Default is "false".
+
+.^|password
+.^|String
+.^|Database user password.
+
+.^|username
+.^|String
+.^|Database user name.
+
+|===
+
+Example - creating a DB schema on a local HSQLDB database:
+
+[source,xml,subs="verbatim,attributes"]
+----
+<plugin>
+    <groupId>org.apache.cayenne.plugins</groupId>
+    <artifactId>maven-cayenne-plugin</artifactId>
+    <version>{version}</version>
+
+    <executions>
+        <execution>
+            <configuration>
+                <map>${project.basedir}/src/main/resources/my.map.xml</map>
+                <url>jdbc:hsqldb:hsql://localhost/testdb</url>
+                <adapter>org.apache.cayenne.dba.hsqldb.HSQLDBAdapter</adapter>
+                <driver>org.hsqldb.jdbcDriver</driver>
+                <username>sa</username>
+            </configuration>
+            <goals>
+                <goal>cdbgen</goal>
+            </goals>
+        </execution>
+    </executions>
+</plugin>
+----
+
+[[mavenCdbimort]]
+===== cdbimport
+
+`cdbimport` is a `maven-cayenne-plugin` goal that generates a DataMap based on an existing database schema. By default, it is bound to the generate-sources phase. This allows you to generate your DataMap prior to building your project, which may be necessary if you are also using the cgen task.
+
+
+[#cdbimportTable.table.table-bordered]
+.cdbimport parameters
+[cols="2,1,2,5"]
+|===
+|Name |Type |Required |Description
+
+.^|map
+.^|File
+.^|Yes
+.^|DataMap XML file which is the destination of the schema import. Can be an existing file. If this file does not exist, it is created when cdbimport is executed. E.g. `${project.basedir}/src/main/resources/my.map.xml`. If "overwrite" is true (the default), an existing DataMap will be used as a template for the new imported DataMap, i.e. all its entities will be cleared and recreated, but its common settings, such as default Java package, will be preserved (unless changed explicitly in the plugin configuration).
+
+.^|driver
+.^|String
+.^|Yes
+.^|A class of JDBC driver to use for the target database.
+
+.^|url
+.^|String
+.^|Yes
+.^|JDBC connection URL of a target database.
+
+.^|adapter
+.^|String
+.^|No
+.^|A Java class name implementing org.apache.cayenne.dba.DbAdapter. This attribute is optional. If not specified, AutoAdapter is used, which will attempt to guess the DB type.
+
+.^|importProcedures
+.^|boolean
+.^|No
+.^|Indicates whether stored procedures should be imported from the database. Default is false.
+
+.^|meaningfulPk
+.^|boolean
+.^|No
+.^|Indicates whether primary keys should be mapped as attributes of the ObjEntity. Default is false.
+
+.^|namingStrategy
+.^|String
+.^|No
+.^|The naming strategy used for mapping database names to object entity names. Default is `org.apache.cayenne.map.naming.SmartNamingStrategy`.
+
+.^|overwriteExisting
+.^|boolean
+.^|No
+.^|Indicates whether existing DB and object entities should be overwritten. This is an all-or-nothing setting. If you need finer granularity, use the CayenneModeler. Default is "true".
+
+.^|password
+.^|String
+.^|No
+.^|Database user password.
+
+.^|procedurePattern
+.^|String
+.^|No
+.^|Pattern to match stored procedure names against for import. Default is to match all stored procedures. This value is only meaningful if importProcedures is true.
+
+.^|schemaName
+.^|String
+.^|No
+.^|Database schema to import tables/stored procedures from.
+
+.^|tablePattern
+.^|String
+.^|No
+.^|Pattern to match table names against for import. Default is to match all tables.
+
+.^|username
+.^|String
+.^|No
+.^|Database user name.
+
+|===
+
+Example - loading a DB schema from a local HSQLDB database (essentially a reverse operation compared to the cdbgen example above) :
+
+[source, XML,,subs="verbatim,attributes"]
+----
+<plugin>
+    <groupId>org.apache.cayenne.plugins</groupId>
+    <artifactId>cayenne-maven-plugin</artifactId>
+    <version>{version}</version>
+
+    <executions>
+        <execution>
+            <configuration>
+                <map>${project.basedir}/src/main/resources/my.map.xml</map>
+                <url>jdbc:mysql://127.0.0.1/mydb</url>
+                <adapter>org.apache.cayenne.dba.hsqldb.HSQLDBAdapter</adapter>
+                <driver>com.mysql.jdbc.Driver</driver>
+                <username>sa</username>
+            </configuration>
+            <goals>
+                <goal>cdbimport</goal>
+            </goals>
+        </execution>
+    </executions>
+</plugin>
+----
+
+==== Ant Projects
+
+===== cgen
+
+===== cdbgen
+
+===== cdbimport
+
+This is an Ant counterpart of "cdbimport" goal of cayenne-maven-plugin described above. It has exactly the same properties. Here is a usage example:
+
+[source, XML]
+----
+ <cdbimport map="${context.dir}/WEB-INF/my.map.xml"
+     driver="com.mysql.jdbc.Driver"
+     url="jdbc:mysql://127.0.0.1/mydb"
+     username="sa"/>
+----
+
+===== cdataport
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
new file mode 100644
index 0000000..6102f0c
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/lifecycle.adoc
@@ -0,0 +1,280 @@
+// 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.
+
+=== Lifecycle Events
+
+An application might be interested in getting notified when a Persistent object moves through its lifecycle (i.e. fetched from DB, created, modified, committed). E.g. when a new object is created, the application may want to initialize its default properties (this can't be done in constructor, as constructor is also called when an object is fetched from DB). Before save, the application may perform validation and/or set some properties (e.g. "updatedTimestamp"). After save it may want to create an audit record for each saved object, etc., etc.
+
+All this can be achieved by declaring callback methods either in Persistent objects or in non-persistent listener classes defined by the application (further simply called "listeners"). There are eight types of lifecycle events supported by Cayenne, listed later in this chapter. When any such event occurs (e.g. an object is committed), Cayenne would invoke all appropriate callbacks. Persistent objects would receive their own events, while listeners would receive events from any objects.
+
+Cayenne allows to build rather powerful and complex "workflows" or "processors" tied to objects lifecycle, especially with listeners, as they have full access to the application evnironment outside Cayenne. This power comes from such features as filtering which entity events are sent to a given listener and the ability to create a common operation context for multiple callback invocations. All of these are discussed later in this chapter.
+
+==== Types of Lifecycle Events
+
+Cayenne defines the following 8 types of lifecycle events for which callbacks can be regsitered:
+
+[#lifecycleEvent.table.table-bordered]
+.Lifecycle Event Types
+[cols="1,4"]
+|===
+|Event |Occurs...
+
+.^|PostAdd
+.^|right after a new object is created inside `ObjectContext.newObject()`. When this event is fired the object is already registered with its ObjectContext and has its ObjectId and ObjectContext properties set.
+
+.^|PrePersist
+.^|right before a new object is committed, inside `ObjectContext.commitChanges()` and `ObjectContext.commitChangesToParent()` (and after `"validateForInsert()"`).
+
+.^|PreUpdate
+.^|right before a modified object is committed, inside `ObjectContext.commitChanges()` and `ObjectContext.commitChangesToParent()` (and after `"validateForUpdate()"`).
+
+.^|PreRemove
+.^|right before an object is deleted, inside `ObjectContext.deleteObjects()`. The event is also generated for each object indirectly deleted as a result of CASCADE delete rule.
+
+.^|PostPersist
+.^|right after a commit of a new object is done, inside `ObjectContext.commitChanges()`.
+
+.^|PostUpdate
+.^|right after a commit of a modified object is done, inside `ObjectContext.commitChanges()`.
+
+.^|PostRemove
+.^|right after a commit of a deleted object is done, inside `ObjectContext.commitChanges()`.
+
+.^|PostLoad
+a|
+- After an object is fetched inside ObjectContext.performQuery().
+- After an object is reverted inside ObjectContext.rollbackChanges().
+- Anytime a faulted object is resolved (i.e. if a relationship is fetched).
+|===
+
+==== Callbacks on Persistent Objects
+
+Callback methods on Persistent classes are mapped in CayenneModeler for each ObjEntity. Empty callback methods are automatically created as a part of class generation (either with Maven, Ant or the Modeler) and are later filled with appropriate logic by the programmer. E.g. assuming we mapped a 'post-add' callback called 'onNewOrder' in ObjEntity 'Order', the following code will be generated:
+
+[source, Java]
+----
+public abstract class _Order extends CayenneDataObject {
+    protected abstract void onNewOrder();
+}
+
+public class Order extends _Order {
+
+    @Override
+    protected void onNewOrder() {
+        //TODO: implement onNewOrder
+    }
+}
+----
+
+As `onNewOrder()` is already declared in the mapping, it does not need to be registered explicitly. Implementing the method in subclass to do something meaningful is all that is required at this point.
+
+As a rule callback methods do not have any knowledge of the outside application, and can only access the state of the object itself and possibly the state of other persistent objects via object's own ObjectContext.
+
+NOTE: Validation and callbacks: There is a clear overlap in functionality between object callbacks and `DataObject.validateForX()` methods. In the future validation may be completely superceeded by callbacks. It is a good idea to use "validateForX" strictly for validation (or not use it at all). Updating the state before commit should be done via callbacks.
+
+==== Callbacks on Non-Persistent Listeners
+
+NOTE: While listener callback methods can be declared in the Modeler (at least as of this wrting), which ensures their automatic registration in runtime, there's a big downside to it. The power of the listeners lies in their complete separation from the XML mapping. The mapping once created, can be reused in different contexts each having a different set of listeners. Placing a Java class of the listener in the XML mapping, and relying on Cayenne to instantiate the listeners severly limits mapping reusability. Further down in this chapter we'll assume that the listener classes are never present in the DataMap and are registered via API.
+
+A listener is simply some application class that has one or more annotated callback methods. A callback method signature should be `void someMethod(SomePersistentType object)`. It can be public, private, protected or use default access:
+
+[source, Java]
+----
+ public class OrderListener {
+
+   @PostAdd(Order.class)
+   public void setDefaultsForNewOrder(Order o) {
+      o.setCreatedOn(new Date());
+   }
+}
+----
+
+Notice that the example above contains an annotation on the callback method that defines the type of the event this method should be called for. Before we go into annotation details, we'll show how to create and register a listener with Cayenne. It is always a user responsibility to register desired application listeners, usually right after ServerRuntime is started. Here is an example:
+
+First let's define 2 simple listeners.
+
+[source, Java]
+----
+public class Listener1 {
+
+    @PostAdd(MyEntity.class)
+    void postAdd(Persistent object) {
+        // do something
+    }
+}
+
+public class Listener2 {
+
+    @PostRemove({ MyEntity1.class, MyEntity2.class })
+    void postRemove(Persistent object) {
+        // do something
+    }
+
+    @PostUpdate({ MyEntity1.class, MyEntity2.class })
+    void postUpdate(Persistent object) {
+        // do something
+    }
+}
+----
+
+Ignore the annotations for a minute. The important point here is that the listeners are arbitrary classes unmapped and unknown to Cayenne, that contain some callback methods. Now let's register them with runtime:
+
+[source, Java]
+----
+ServerRuntime runtime = ...
+
+LifecycleCallbackRegistry registry =
+    runtime.getDataDomain().getEntityResolver().getCallbackRegistry();
+
+registry.addListener(new Listener1());
+registry.addListener(new Listener2());
+----
+
+
+Listeners in this example are very simple. However they don't have to be. Unlike Persistent objects, normally listeners initialization is managed by the application code, not Cayenne, so listeners may have knowledge of various application services, operation transactional context, etc. Besides a single listener can apply to multiple entities. As a consequence their callbacks can do more than just access a single ObjectContext.
+
+Now let's discuss the annotations. There are eight annotations exactly matching the names of eight lifecycle events. A callback method in a listener should be annotated with at least one, but possibly with more than one of them. Annotation itself defines what event the callback should react to. Annotation parameters are essentially an entity filter, defining a subset of ObjEntities whose events we are interested in:
+
+[source, Java]
+----
+// this callback will be invoked on PostRemove event of any object
+// belonging to MyEntity1, MyEntity2 or their subclasses
+@PostRemove({ MyEntity1.class, MyEntity2.class })
+void postRemove(Persistent object) {
+    ...
+}
+----
+
+[source, Java]
+----
+// similar example with multipe annotations on a single method
+// each matching just one entity
+@PostPersist(MyEntity1.class)
+@PostRemove(MyEntity1.class)
+@PostUpdate(MyEntity1.class)
+void postCommit(MyEntity1 object) {
+    ...
+}
+----
+
+As shown above, "value" (the implicit annotation parameter) can contain one or more entity classes. Only these entities' events will result in callback invocation. There's also another way to match entities - via custom annotations. This allows to match any number of entities without even knowing what they are. Here is an example. We'll first define a custom annotation:
+
+[source, Java]
+----
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Tag {
+
+}
+----
+
+Now we can define a listener that will react to events from ObjEntities annotated with this annotation:
+
+[source, Java]
+----
+public class Listener3 {
+
+    @PostAdd(entityAnnotations = Tag.class)
+    void postAdd(Persistent object) {
+        // do something
+    }
+}
+----
+
+As you see we don't have any entities yet, still we can define a listener that does something useful. Now let's annotate some entities:
+
+[source, Java]
+----
+@Tag
+public class MyEntity1 extends _MyEntity1 {
+
+}
+
+@Tag
+public class MyEntity2 extends _MyEntity2 {
+
+}
+----
+
+
+==== Combining Listeners with DataChannelFilters
+
+A final touch in the listeners design is preserving the state of the listener within a single select or commit, so that events generated by multiple objects can be collected and processed all together. To do that you will need to implement a `DataChannelFilter`, and add some callback methods to it. They will store their state in a ThreadLocal variable of the filter. Here is an example filter that does something pretty meaningless - counts how many total objects were committed. However it demonstrates the important pattern of aggregating multiple events and presenting a combined result:
+
+[source, Java]
+----
+public class CommittedObjectCounter implements DataChannelFilter {
+
+    private ThreadLocal<int[]> counter;
+
+    @Override
+    public void init(DataChannel channel) {
+        counter = new ThreadLocal<int[]>();
+    }
+
+    @Override
+    public QueryResponse onQuery(ObjectContext originatingContext, Query query, DataChannelFilterChain filterChain) {
+        return filterChain.onQuery(originatingContext, query);
+    }
+
+    @Override
+    public GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType,
+            DataChannelFilterChain filterChain) {
+
+        // init the counter for the current commit
+        counter.set(new int[1]);
+
+        try {
+            return filterChain.onSync(originatingContext, changes, syncType);
+        } finally {
+
+            // process aggregated result and release the counter
+            System.out.println("Committed " + counter.get()[0] + " object(s)");
+            counter.set(null);
+        }
+    }
+
+    @PostPersist(entityAnnotations = Tag.class)
+    @PostUpdate(entityAnnotations = Tag.class)
+    @PostRemove(entityAnnotations = Tag.class)
+    void afterCommit(Persistent object) {
+        counter.get()[0]++;
+    }
+}
+----
+
+Now since this is both a filter and a listener, it needs to be registered as such:
+
+[source, Java]
+----
+CommittedObjectCounter counter = new CommittedObjectCounter();
+
+ServerRuntime runtime = ...
+DataDomain domain = runtime.getDataDomain();
+
+// register filter
+domain.addFilter(counter);
+
+// register listener
+domain.getEntityResolver().getCallbackRegistry().addListener(counter);
+----
+
+
+
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/objectContext.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/objectContext.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/objectContext.adoc
new file mode 100644
index 0000000..9424a70
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/objectContext.adoc
@@ -0,0 +1,309 @@
+// 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.
+
+=== Persistent Objects and ObjectContext
+
+==== ObjectContext
+
+ObjectContext is an interface that users normally work with to access the database. It provides the API to execute database operations and to manage persistent objects. A context is obtained from the ServerRuntime:
+
+[source, java]
+----
+ObjectContext context = runtime.getContext();
+----
+
+The call above creates a new instance of ObjectContext that can access the database via this runtime. ObjectContext is a single "work area" in Cayenne, storing persistent objects. ObjectContext guarantees that for each database row with a unique ID it will contain at most one instance of an object, thus ensuring object graph consistency between multiple selects (a feature called "uniquing"). At the same time different ObjectContexts will have independent copies of objects for each unique database row. This allows users to isolate object changes from one another by using separate ObjectContexts.
+
+These properties directly affect the strategies for scoping and sharing (or not sharing) ObjectContexts. Contexts that are only used to fetch objects from the database and whose objects are never modified by the application can be shared between mutliple users (and multiple threads). Contexts that store modified objects should be accessed only by a single user (e.g. a web application user might reuse a context instance between multiple web requests in the same HttpSession, thus carrying uncommitted changes to objects from request to request, until he decides to commit or rollback them). Even for a single user it might make sense to use mutliple ObjectContexts (e.g. request-scoped contexts to allow concurrent requests from the browser that change and commit objects independently).
+
+ObjectContext is serializable and does not permanently hold to any of the application resources. So it does not have to be closed. If the context is not used anymore, it should simply be allowed to go out of scope and get garbage collected, just like any other Java object.
+
+
+==== Persistent Object and its Lifecycle
+
+Cayenne can persist Java objects that implement `org.apache.cayenne.Persistent` interface. Generally persistent classes are generated from the model as described above, so users do not have to worry about superclass and property implementation details.
+
+Persistent interface provides access to 3 persistence-related properties - objectId, persistenceState and objectContext. All 3 are initialized by Cayenne runtime framework. Application code should not attempt to change them. However it is allowed to read them, which provides valuable runtime information. E.g. ObjectId can be used for quick equality check of 2 objects, knowing persistence state would allow highlighting changed objects, etc.
+
+Each persistent object belongs to a single ObjectContext, and can be in one of the following persistence states (as defined in `org.apache.cayenne.PersistenceState`) :
+
+[#persistenceStates.table.table-bordered]
+.Persistence States
+// ^.^ is not a funny face it's Asciidoctor alignment syntax (center both vertical and horizontal)
+[cols="^.^1,4"]
+|===
+
+.^|TRANSIENT
+.^|The object is not registered with an ObjectContext and will not be persisted.
+
+.^|NEW
+.^|The object is freshly registered in an ObjectContext, but has not been saved to the database yet and there is no matching database row.
+
+.^|COMMITED
+.^|The object is registered in an ObjectContext, there is a row in the database corresponding to this object, and the object state corresponds to the last known state of the matching database row.
+
+.^|MODIFIED
+.^|The object is registered in an ObjectContext, there is a row in the database corresponding to this object, but the object in-memory state has diverged from the last known state of the matching database row.
+
+.^|HOLLOW
+.^|The object is registered in an ObjectContext, there is a row in the database corresponding to this object, but the object state is unknown. Whenever an application tries to access a property of such object, Cayenne attempts reading its values from the database and "inflate" the object, turning it to COMMITED.
+
+.^|DELETED
+.^|The object is registered in an ObjectContext and has been marked for deletion in-memory. The corresponding row in the database will get deleted upon ObjectContext commit, and the object state will be turned into TRANSIENT.
+|===
+
+==== ObjectContext Persistence API
+
+One of the first things users usually want to do with an ObjectContext is to select some objects from a database. This is done by calling "performQuery" method:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+List<Artist> artists = context.performQuery(query);
+----
+
+We'll discuss queries in some detail in the following chapters. The example above is self-explanatory - we create a SelectQuery that matches all Artist objects present in the database, and then call "performQuery", getting a list of Artist objects.
+
+Some queries can be quite complex, returning multiple result sets or even updating the database. For such queries ObjectContext provides "performGenericQuery"method. While not nearly as commonly-used as "performQuery", it is nevertheless important in some situations. E.g.:
+
+[source, java]
+----
+Collection<Query> queries = ... // multiple queries that need to be run together
+QueryChain query = new QueryChain(queries);
+
+QueryResponse response = context.performGenericQuery(query);
+----
+
+
+An application might modify selected objects. E.g.:
+
+[source, java]
+----
+Artist selectedArtist = artists.get(0);
+selectedArtist.setName("Dali");
+----
+
+The first time the object property is changed, the object's state is automatically set to "MODIFIED" by Cayenne. Cayenne tracks all in-memory changes until a user calls "commitChanges":
+
+[source, java]
+----
+context.commitChanges();
+----
+
+At this point all in-memory changes are analyzed and a minimal set of SQL statements is issued in a single transaction to synchronize the database with the in-memory state. In our example "commitChanges" commits just one object, but generally it can be any number of objects.
+
+If instead of commit, we wanted to reset all changed objects to the previously committed state, we'd call `rollbackChanges` instead:
+
+[source, java]
+----
+context.rollbackChanges();
+----
+
+"newObject" method call creates a persistent object and sets its state to "NEW":
+
+[source, java]
+----
+Artist newArtist = context.newObject(Artist.class);
+newArtist.setName("Picasso");
+----
+
+It will only exist in memory until "commitChanges" is issued. On commit Cayenne might generate a new primary key (unless a user set it explicitly, or a PK was inferred from a relationship) and issue an INSERT SQL statement to permanently store the object.
+
+`deleteObjects` method takes one or more Persistent objects and marks them as "DELETED":
+
+[source, java]
+----
+context.deleteObjects(artist1);
+context.deleteObjects(artist2, artist3, artist4);
+----
+
+Additionally "deleteObjects" processes all delete rules modeled for the affected objects. This may result in implicitly deleting or modifying extra related objects. Same as insert and update, delete operations are sent to the database only when "commitChanges" is called. Similarly "rollbackChanges" will undo the effect of "newObject" and "deleteObjects".
+
+`localObject` returns a copy of a given persistent object that is "local" to a given ObjectContext:
+
+Since an application often works with more than one context, "localObject" is a rather common operation. E.g. to improve performance a user might utilize a single shared context to select and cache data, and then occasionally transfer some selected objects to another context to modify and commit them:
+
+
+[source, java]
+----
+ObjectContext editingContext = runtime.newContext();
+Artist localArtist = editingContext.localObject(artist);
+----
+
+Often an appliction needs to inspect mapping metadata. This information is stored in the EntityResolver object, accessible via the ObjectContext:
+
+[source, java]
+----
+EntityResolver resolver = objectContext.getEntityResolver();
+----
+
+Here we discussed the most commonly used subset of the ObjectContext API. There are other useful methods, e.g. those allowing to inspect registered objects state in bulk, etc. Check the latest JavaDocs for details.
+
+==== Cayenne Helper Class
+
+There is a useful helper class called "Cayenne" (fully-qualified name `"org.apache.cayenne.Cayenne"`) that builds on ObjectContext API to provide a number of very common operations. E.g. get a primary key (most entities do not model PK as an object property) :
+
+[source, java]
+----
+long pk = Cayenne.longPKForObject(artist);
+----
+
+It also provides the reverse operation - finding an object given a known PK:
+
+[source, java]
+----
+Artist artist = Cayenne.objectForPK(context, Artist.class, 34579);
+----
+
+If a query is expected to return 0 or 1 object, Cayenne helper class can be used to find this object. It throws an exception if more than one object matched the query:
+
+[source, java]
+----
+Artist artist = (Artist) Cayenne.objectForQuery(context, new SelectQuery(Artist.class));
+----
+
+Feel free to explore Cayenne class API for other useful methods.
+
+==== ObjectContext Nesting
+In all the examples shown so far an ObjectContext would directly connect to a database to select data or synchronize its state (either via commit or rollback). However another context can be used in all these scenarios instead of a database. This concept is called ObjectContext "nesting". Nesting is a parent/child relationship between two contexts, where child is a nested context and selects or commits its objects via a parent.
+
+Nesting is useful to create isolated object editing areas (child contexts) that need to all be committed to an intermediate in-memory store (parent context), or rolled back without affecting changes already recorded in the parent. Think cascading GUI dialogs, or parallel AJAX requests coming to the same session.
+
+In theory Cayenne supports any number of nesting levels, however applications should generally stay with one or two, as deep hierarchies will most certainly degrade the performance of the deeply nested child contexts. This is due to the fact that each context in a nesting chain has to update its own objects during most operations.
+
+Cayenne ROP is an extreme case of nesting when a child context is located in a separate JVM and communicates with its parent via a web service. ROP is discussed in details in the following chapters. Here we concentrate on the same-VM nesting.
+
+To create a nested context, use an instance of ServerRuntime, passing it the desired parent:
+
+[source, java]
+----
+ObjectContext parent = runtime.getContext();
+ObjectContext nested = runtime.getContext((DataChannel) parent);
+----
+
+From here a nested context operates just like a regular context (you can perform queries, create and delete objects, etc.). The only difference is that commit and rollback operations can either be limited to synchronization with the parent, or cascade all the way to the database:
+
+[source, java]
+----
+// merges nested context changes into the parent context
+nested.commitChangesToParent();
+
+// regular 'commitChanges' cascades commit through the chain
+// of parent contexts all the way to the database
+nested.commitChanges();
+----
+
+[source, java]
+----
+// unrolls all local changes, getting context in a state identical to parent
+nested.rollbackChangesLocally();
+
+// regular 'rollbackChanges' cascades rollback through the chain of contexts
+// all the way to the topmost parent
+nested.rollbackChanges();
+----
+
+==== Generic Persistent Objects
+
+As described in the CayenneModeler chapter, Cayenne supports mapping of completely generic classes to specific entities. Although for conveniece most applications should stick with entity-specific class mappings, the generic feature offers some interesting possibilities, such as creating mappings completely on the fly in a running application, etc.
+
+Generic objects are first class citizens in Cayenne, and all common persistent operations apply to them as well. There are some pecularities however, described below.
+
+When creating a new generic object, either cast your ObjectContext to DataContext (that provides "newObject(String)" API), or provide your object with an explicit ObjectId:
+
+[source, java]
+----
+DataObject generic = ((DataContext) context).newObject("GenericEntity");
+----
+
+[source, java]
+----
+DataObject generic = new CayenneDataObject();
+generic.setObjectId(new ObjectId("GenericEntity"));
+context.registerNewObject(generic);
+----
+
+SelectQuery for generic object should be created passing entity name String in constructor, instead of a Java class:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery("GenericEntity");
+----
+
+Use DataObject API to access and modify properties of a generic object:
+
+[source, java]
+----
+String name = (String) generic.readProperty("name");
+generic.writeProperty("name", "New Name");
+----
+
+This is how an application can obtain entity name of a generic object:
+
+[source, java]
+----
+String entityName = generic.getObjectId().getEntityName();
+----
+
+
+==== Transactions
+
+Considering how much attention is given to managing transactions in most other ORMs, transactions have been conspicuously absent from the ObjectContext discussion till now. The reason is that transactions are seamless in Cayenne in all but a few special cases. ObjectContext is an in-memory container of objects that is disconnected from the database, except when it needs to run an operation. So it does not care about any surrounding transaction scope. Sure enough all database operations are transactional, so when an application does a commit, all SQL execution is wrapped in a database transaction. But this is done behind the scenes and is rarely a concern to the application code.
+
+Two cases where transactions need to be taken into consideration are container-managed and application-managed transactions.
+
+If you are using an EJB container (or some other JTA environment), you'll likely need to switch Cayenne runtime into "external transactions mode". This is either done in the Modeler (check DataDomain > 'Container-Managed Transactions' checkbox), or in the code:
+
+[source, java]
+----
+runtime.getDataDomain().setUsingExternalTransactions(true);
+----
+
+In this case Cayenne assumes that JDBC Connections obtained by runtime whenever that might happen are all coming from a transactional DataSource managed by the container. In this case Cayenne does not attempt to commit or rollback the connections, leaving it up to the container to do that when appropriate.
+
+In the second scenario, an application might need to define its own transaction scope that spans more than one Cayenne operation. E.g. two sequential commits that need to be rolled back together in case of failure. This can be done with an explicit thread-bound transaction that surrounds a set of operations. Application is responsible for committing or rolling it back:
+
+[source, java]
+----
+Transaction tx = runtime.getDataDomain().createTransaction();
+Transaction.bindThreadTransaction(tx);
+
+try {
+    // commit one or more contexts
+    context1.commitChanges();
+    context2.commitChanges();
+    ....
+    // after changing some objects in context1, commit again
+    context1.commitChnages();
+    ....
+    // if no failures, commit
+    tx.commit();
+}
+catch (Exception ex) {
+    tx.setRollbackOnly();
+}
+finally {
+    Transaction.bindThreadTransaction(null);
+
+    if (tx.getStatus() == Transaction.STATUS_MARKED_ROLLEDBACK) {
+        try {
+           tx.rollback();
+        }
+        catch (Exception rollbackEx) {
+        }
+    }
+}
+----
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/orderings.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/orderings.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/orderings.adoc
new file mode 100644
index 0000000..6b9b57a
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/orderings.adoc
@@ -0,0 +1,36 @@
+// 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.
+
+=== Orderings
+
+An Ordering object defines how a list of objects should be ordered. Orderings are essentially path expressions combined with a sorting strategy. Creating an Ordering:
+
+[source, java]
+----
+Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASCENDING);
+----
+
+Like expressions, orderings are translated into SQL as parts of queries (and the sorting occurs in the database). Also like expressions, orderings can be used in memory, naturally - to sort objects:
+
+[source, java]
+----
+Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASCENDING_INSENSITIVE);
+List<Painting> list = ...
+o.orderList(list);
+----
+
+Note that unlike filtering with Expressions, ordering is performed in-place. This list object is reordered and no new list is created.
+
+
+


[05/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/lifecycle-events.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/lifecycle-events.xml b/docs/docbook/cayenne-guide/src/docbkx/lifecycle-events.xml
deleted file mode 100644
index 364b5da..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/lifecycle-events.xml
+++ /dev/null
@@ -1,333 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="lifecycle-events">
-    <title>Lifecycle Events</title>
-    <para>An application might be interested in getting notified when a Persistent object moves
-        through its lifecycle (i.e. fetched from DB, created, modified, committed). E.g. when a new
-        object is created, the application may want to initialize its default properties (this can't
-        be done in constructor, as constructor is also called when an object is fetched from DB).
-        Before save, the application may perform validation and/or set some properties (e.g.
-        "updatedTimestamp"). After save it may want to create an audit record for each saved object,
-        etc., etc. </para>
-    <para>All this can be achieved by declaring callback methods either in Persistent objects or in
-        non-persistent listener classes defined by the application (further simply called
-        "listeners"). There are eight types of lifecycle events supported by Cayenne, listed later
-        in this chapter. When any such event occurs (e.g. an object is committed), Cayenne would
-        invoke all appropriate callbacks. Persistent objects would receive their own events, while
-        listeners would receive events from any objects. </para>
-    <para>Cayenne allows to build rather powerful and complex "workflows" or "processors" tied to
-        objects lifecycle, especially with listeners, as they have full access to the application
-        evnironment outside Cayenne. This power comes from such features as filtering which entity
-        events are sent to a given listener and the ability to create a common operation context for
-        multiple callback invocations. All of these are discussed later in this chapter.</para>
-    <section xml:id="types-of-lifecycle-events">
-        <title>Types of Lifecycle Events</title>
-        <para>Cayenne defines the following 8 types of lifecycle events for which callbacks can be
-                regsitered:<table frame="void">
-                <caption>Lifecycle Event Types</caption>
-                <col width="16%"/>
-                <col width="84%"/>
-                <thead>
-                    <tr>
-                        <th>Event</th>
-                        <th>Occurs...</th>
-                    </tr>
-                </thead>
-                <tbody>
-                    <tr>
-                        <td>PostAdd</td>
-                        <td>right after a new object is created inside
-                                <code>ObjectContext.newObject()</code>. When this event is fired the
-                            object is already registered with its ObjectContext and has its ObjectId
-                            and ObjectContext properties set.</td>
-                    </tr>
-                    <tr>
-                        <td>PrePersist</td>
-                        <td>right before a new object is committed, inside
-                                <code>ObjectContext.commitChanges()</code> and
-                                <code>ObjectContext.commitChangesToParent()</code> (and prior to
-                                "<code>validateForInsert()</code>").</td>
-                    </tr>
-                    <tr>
-                        <td>PreUpdate</td>
-                        <td>right before a modified object is committed, inside
-                                <code>ObjectContext.commitChanges()</code> and
-                                <code>ObjectContext.commitChangesToParent()</code> (and prior to
-                                "<code>validateForUpdate()</code>").</td>
-                    </tr>
-                    <tr>
-                        <td>PreRemove</td>
-                        <td>right before an object is deleted, inside
-                                <code>ObjectContext.deleteObjects()</code>. The event is also
-                            generated for each object indirectly deleted as a result of CASCADE
-                            delete rule.</td>
-                    </tr>
-                    <tr>
-                        <td>PostPersist</td>
-                        <td>right after a commit of a new object is done, inside
-                                <code>ObjectContext.commitChanges()</code>.</td>
-                    </tr>
-                    <tr>
-                        <td>PostUpdate</td>
-                        <td>right after a commit of a modified object is done, inside
-                                <code>ObjectContext.commitChanges()</code>.</td>
-                    </tr>
-                    <tr>
-                        <td>PostRemove</td>
-                        <td>right after a commit of a deleted object is done, inside
-                                <code>ObjectContext.commitChanges()</code>.</td>
-                    </tr>
-                    <tr>
-                        <td>PostLoad</td>
-                        <td>
-                            <itemizedlist>
-                                <listitem>
-                                    <para>After an object is fetched inside
-                                            <code>ObjectContext.performQuery()</code>.</para>
-                                </listitem>
-                                <listitem>
-                                    <para>After an object is reverted inside
-                                            <code>ObjectContext.rollbackChanges()</code>.</para>
-                                </listitem>
-                                <listitem>
-                                    <para>Anytime a faulted object is resolved (i.e. if a
-                                        relationship is fetched).</para>
-                                </listitem>
-                            </itemizedlist>
-                        </td>
-                    </tr>
-                </tbody>
-            </table></para>
-    </section>
-    <section xml:id="callback-persistent">
-        <title>Callbacks on Persistent Objects</title>
-        <para>Callback methods on Persistent classes are mapped in CayenneModeler for each
-            ObjEntity. Empty callback methods are automatically created as a part of class
-            generation (either with Maven, Ant or the Modeler) and are later filled with appropriate
-            logic by the programmer. E.g. assuming we mapped a 'post-add' callback called
-            'onNewOrder' in ObjEntity 'Order', the following code will be
-            generated:<programlisting language="java">public abstract class _Order extends CayenneDataObject {
-    protected abstract void onNewOrder();
-}
-
-public class Order extends _Order {
-
-    @Override
-    protected void onNewOrder() {
-        //TODO: implement onNewOrder
-    }
-}</programlisting></para>
-        <para>As <code>onNewOrder()</code> is already declared in the mapping, it does not need to
-            be registered explicitly. Implementing the method in subclass to do something meaningful
-            is all that is required at this point. </para>
-        <para>As a rule callback methods do not have any knowledge of the outside application, and
-            can only access the state of the object itself and possibly the state of other
-            persistent objects via object's own ObjectContext.</para>
-        <para>
-            <note>
-                <para><emphasis role="italic">Validation and callbacks:</emphasis> There is a clear
-                    overlap in functionality between object callbacks and
-                        <code>DataObject.validateForX()</code> methods. In the future validation may
-                    be completely superceeded by callbacks. It is a good idea to use "validateForX"
-                    strictly for validation (or not use it at all). Updating the state before commit
-                    should be done via callbacks.</para>
-            </note>
-        </para>
-    </section>
-    <section xml:id="callback-non-persistent">
-        <title>Callbacks on Non-Persistent Listeners</title>
-        
-            <para>
-                <note>
-                    <para>While listener callback methods can be declared in the Modeler (at least
-                        as of this wrting), which ensures their automatic registration in runtime,
-                        there's a big downside to it. The power of the listeners lies in their
-                        complete separation from the XML mapping. The mapping once created, can be
-                        reused in different contexts each having a different set of listeners.
-                        Placing a Java class of the listener in the XML mapping, and relying on
-                        Cayenne to instantiate the listeners severly limits mapping reusability.
-                        Further down in this chapter we'll assume that the listener classes are
-                        never present in the DataMap and are registered via API.</para>
-                </note>
-            </para>
-            <para>A listener is simply some application class that has one or more annotated
-            callback methods. A callback method signature should be <code>void
-                someMethod(SomePersistentType object)</code>. It can be public, private, protected
-            or use default access:</para>
-            <para>
-                <programlisting language="java"> public class OrderListener { 
-  
-   @PostAdd(Order.class)
-   public void setDefaultsForNewOrder(Order o) {
-      o.setCreatedOn(new Date());
-   }
-}</programlisting>
-            </para>
-        <para>Notice that the example above contains an annotation on the callback method that
-            defines the type of the event this method should be called for. Before we go into
-            annotation details, we'll show how to create and register a listener with Cayenne. It is
-            always a user responsibility to register desired application listeners, usually right
-            after ServerRuntime is started. Here is an example:</para>
-        <para>First let's define 2 simple
-            listeners.<programlisting language="java">public class Listener1 {
-
-    @PostAdd(MyEntity.class)
-    void postAdd(Persistent object) {
-        // do something
-    }
-}
-
-public class Listener2 {
-
-    @PostRemove({ MyEntity1.class, MyEntity2.class })
-    void postRemove(Persistent object) {
-        // do something
-    }
-
-    @PostUpdate({ MyEntity1.class, MyEntity2.class })
-    void postUpdate(Persistent object) {
-        // do something
-    }
-}</programlisting></para>
-        <para>Ignore the annotations for a minute. The important point here is that the listeners
-            are arbitrary classes unmapped and unknown to Cayenne, that contain some callback
-            methods. Now let's register them with
-            runtime:<programlisting language="java">ServerRuntime runtime = ...
-
-LifecycleCallbackRegistry registry = 
-    runtime.getDataDomain().getEntityResolver().getCallbackRegistry();
-
-registry.addListener(new Listener1());
-registry.addListener(new Listener2());</programlisting></para>
-        <para>Listeners in this example are very simple. However they don't have to be. Unlike
-            Persistent objects, normally listeners initialization is managed by the application
-            code, not Cayenne, so listeners may have knowledge of various application services,
-            operation transactional context, etc. Besides a single listener can apply to multiple
-            entities. As a consequence their callbacks can do more than just access a single
-            ObjectContext. </para>
-        <para>Now let's discuss the annotations. There are eight annotations exactly matching the
-            names of eight lifecycle events. A callback method in a listener should be annotated
-            with at least one, but possibly with more than one of them. Annotation itself defines
-            what event the callback should react to. Annotation parameters are essentially an entity
-            filter, defining a subset of ObjEntities whose events we are interested
-            in:<programlisting language="java">// this callback will be invoked on PostRemove event of any object 
-// belonging to MyEntity1, MyEntity2 or their subclasses
-@PostRemove({ MyEntity1.class, MyEntity2.class })
-void postRemove(Persistent object) {
-    ...
-}</programlisting><programlisting language="java">// similar example with multipe annotations on a single method
-// each matching just one entity
-@PostPersist(MyEntity1.class)
-@PostRemove(MyEntity1.class)
-@PostUpdate(MyEntity1.class)
-void postCommit(MyEntity1 object) {
-    ...
-}</programlisting></para>
-        <para>As shown above, "value" (the implicit annotation parameter) can contain one or more
-            entity classes. Only these entities' events will result in callback invocation. There's
-            also another way to match entities - via custom annotations. This allows to match any
-            number of entities without even knowing what they are. Here is an example. We'll first
-            define a custom
-            annotation:<programlisting language="java">@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Tag {
-
-}</programlisting></para>
-        <para>Now we can define a listener that will react to events from ObjEntities annotated with
-            this
-            annotation:<programlisting language="java">public class Listener3 {
-
-    @PostAdd(entityAnnotations = Tag.class)
-    void postAdd(Persistent object) {
-        // do something
-    }
-}</programlisting></para>
-        <para>As you see we don't have any entities yet, still we can define a listener that does
-            something useful. Now let's annotate some
-            entities:<programlisting language="java">@Tag
-public class MyEntity1 extends _MyEntity1 {
-
-}
-
-@Tag
-public class MyEntity2 extends _MyEntity2 {
-
-}</programlisting></para>
-        </section>
-
-    <section xml:id="comining-listeners-with-datachannelfilters">
-        <title>Combining Listeners with DataChannelFilters</title>
-        <para>A final touch in the listeners design is preserving the state of the listener within a
-            single select or commit, so that events generated by multiple objects can be collected
-            and processed all together. To do that you will need to implement a
-                <code>DataChannelFilter</code>, and add some callback methods to it. They will store
-            their state in a ThreadLocal variable of the filter. Here is an example filter that does
-            something pretty meaningless - counts how many total objects were committed. However it
-            demonstrates the important pattern of aggregating multiple events and presenting a
-            combined
-            result:<programlisting language="java">public class CommittedObjectCounter implements DataChannelFilter {
-
-    private ThreadLocal&lt;int[]> counter;
-
-    @Override
-    public void init(DataChannel channel) {
-        counter = new ThreadLocal&lt;int[]>();
-    }
-
-    @Override
-    public QueryResponse onQuery(ObjectContext originatingContext, Query query, DataChannelFilterChain filterChain) {
-        return filterChain.onQuery(originatingContext, query);
-    }
-
-    @Override
-    public GraphDiff onSync(ObjectContext originatingContext, GraphDiff changes, int syncType,
-            DataChannelFilterChain filterChain) {
-        
-        // init the counter for the current commit
-        counter.set(new int[1]);
-
-        try {
-            return filterChain.onSync(originatingContext, changes, syncType);
-        } finally {
-
-            // process aggregated result and release the counter
-            System.out.println("Committed " + counter.get()[0] + " object(s)");
-            counter.set(null);
-        }
-    }
-
-    @PostPersist(entityAnnotations = Tag.class)
-    @PostUpdate(entityAnnotations = Tag.class)
-    @PostRemove(entityAnnotations = Tag.class)
-    void afterCommit(Persistent object) {
-        counter.get()[0]++;
-    }
-}</programlisting></para>
-        <para>Now since this is both a filter and a listener, it needs to be registered as
-            such:<programlisting language="java">CommittedObjectCounter counter = new CommittedObjectCounter();
-
-ServerRuntime runtime = ...
-DataDomain domain = runtime.getDataDomain();
-
-// register filter
-domain.addFilter(counter);
-
-// register listener
-domain.getEntityResolver().getCallbackRegistry().addListener(counter);</programlisting></para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/orderings.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/orderings.xml b/docs/docbook/cayenne-guide/src/docbkx/orderings.xml
deleted file mode 100644
index f1b9c0e..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/orderings.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="orderings">
-    <title>Orderings</title>
-        <para>An Ordering object defines how a list of objects should be ordered. Orderings are
-            essentially path expressions combined with a sorting strategy. Creating an Ordering:
-            <programlisting language="java">Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASENDING);</programlisting></para>
-        <para>Like expressions, orderings are translated into SQL as parts of queries (and the sorting
-        occurs in the database). Also like expressions, orderings can be used in memory, naturally -
-        to sort
-        objects:<programlisting language="java">Ordering o = new Ordering(Painting.NAME_PROPERTY, SortOrder.ASCENDING_INSENSITIVE);
-List&lt;Painting> list = ...
-o.orderList(list);</programlisting>Note
-        that unlike filtering with Expressions, ordering is performed in-place. This list object is
-        reordered and no new list is created.</para>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/part1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part1.xml b/docs/docbook/cayenne-guide/src/docbkx/part1.xml
deleted file mode 100644
index ac79499..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/part1.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-        xml:id="cayenne-guide-part1" xmlns:xi="http://www.w3.org/2001/XInclude">
-        <title>Object Relational Mapping with Cayenne</title>
-        <xi:include href="setup.xml"/>
-        <xi:include href="cayenne-mapping-structure.xml"/>
-        <xi:include href="cayennemodeler-application.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/part2.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part2.xml b/docs/docbook/cayenne-guide/src/docbkx/part2.xml
deleted file mode 100644
index c5f8201..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/part2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="cayenne-guide-part2" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Cayenne Framework</title>
-    <xi:include href="including-cayenne-in-project.xml"/>
-    <xi:include href="starting-cayenne.xml"/>
-    <xi:include href="persistent-objects-objectcontext.xml"/>
-    <xi:include href="expressions.xml"/>
-    <xi:include href="orderings.xml"/>
-    <xi:include href="queries.xml"/>
-    <xi:include href="lifecycle-events.xml"/>
-    <xi:include href="performance-tuning.xml"/>
-    <xi:include href="customizing-cayenne-runtime.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/part3.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part3.xml b/docs/docbook/cayenne-guide/src/docbkx/part3.xml
deleted file mode 100644
index 75c60b3..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/part3.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="cayenne-guide-part3" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Cayenne Framework - Remote Object Persistence </title>
-    <xi:include href="rop-introduction.xml"/>
-    <xi:include href="rop-setup.xml"/>
-    <xi:include href="implementing-rop-server.xml"/>
-    <xi:include href="implementing-rop-client.xml"/>
-    <xi:include href="rop-deployment.xml"/>
-    <xi:include href="current-limitations.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml b/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
deleted file mode 100644
index 18bb0bc..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
+++ /dev/null
@@ -1,289 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="performance-tuning">
-    <title>Performance Tuning</title>
-    <section xml:id="prefetching">
-        <title>Prefetching</title>
-        <para>Prefetching is a technique that allows to bring back in one query not only the queried
-            objects, but also objects related to them. In other words it is a controlled eager
-            relationship resolving mechanism. Prefetching is discussed in the "Performance Tuning"
-            chapter, as it is a powerful performance optimization method. However another common
-            application of prefetching is to refresh stale object relationships, so more generally
-            it can be viewed as a technique for managing subsets of the object graph.</para>
-        <para>Prefetching example:
-            <programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-
-// this instructs Cayenne to prefetch one of Artist's relationships
-query.addPrefetch("paintings");
-
-// query is expecuted as usual, but the resulting Artists will have
-// their paintings "inflated"
-List&lt;Artist> artists = context.performQuery(query);</programlisting>All
-            types of relationships can be preftetched - to-one, to-many, flattened. </para>
-        <para>A prefetch can span multiple relationships:
-            <programlisting language="java"> query.addPrefetch("paintings.gallery");</programlisting></para>
-        <para>A query can have multiple
-            prefetches:<programlisting language="java">query.addPrefetch("paintings");
-query.addPrefetch("paintings.gallery"); </programlisting></para>
-        <para>If a query is fetching DataRows, all "disjoint" prefetches are ignored, only "joint"
-            prefetches are executed (see prefetching semantics discussion below for what disjoint and
-            joint prefetches mean).</para>
-
-        <section xml:id="prefetching-semantics">
-            <title>Prefetching Semantics</title>
-            <para>Prefetching semantics defines a strategy to prefetch relationships. Depending on
-                it, Cayenne would generate different types of queries. The end result is the same -
-                query root objects with related objects fully resolved. However semantics can affect
-                preformance, in some cases significantly. There are 3 types of prefetch semantics,
-                all defined as constants in
-                org.apache.cayenne.query.PrefetchTreeNode:<programlisting language="java">PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS
-PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS
-PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS</programlisting></para>
-            <para>Each query has a default prefetch semantics, so generally users do not have to
-                worry about changing it, except when performance is a concern, or a few special
-                cases when a default sematics can't produce the correct result. SelectQuery uses
-                DISJOINT_PREFETCH_SEMANTICS by default. Semantics can be changed as
-                follows:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-query.addPrefetch("paintings").setSemantics(
-                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS); </programlisting></para>
-            <para>There's no limitation on mixing different types of semantics in the same
-                SelectQuery. Multiple prefetches each can have its own semantics. </para>
-            <para>SQLTemplate and ProcedureQuery are both using JOINT_PREFETCH_SEMANTICS and it can
-                not be changed due to the nature of these two queries.</para>
-        </section>
-        <section xml:id="disjoint-prefetch-semantics">
-            <title>Disjoint Prefetching Semantics</title>
-            <para>This semantics (only applicable to SelectQuery) results in Cayenne generatiing one
-                SQL statement for the main objects, and a separate statement for each prefetch path
-                (hence "disjoint" - related objects are not fetched with the main query). Each
-                additional SQL statement uses a qualifier of the main query plus a set of joins
-                traversing the preftech path between the main and related entity. </para>
-            <para>This strategy has an advantage of efficient JVM memory use, and faster overall
-                result processing by Cayenne, but it requires (1+N) SQL statements to be executed,
-                where N is the number of prefetched relationships.</para>
-
-        </section>
-        <section xml:id="disjoint-by-id-prefetch-semantics">
-            <title>Disjoint-by-ID Prefetching Semantics</title>
-            <para>This is a variation of disjoint prefetch where related objects are matched against
-                a set of IDs derived from the fetched main objects (or intermediate objects in a
-                multi-step prefetch). Cayenne limits the size of the generated WHERE clause, as most
-                DBs can't parse arbitrary large SQL. So prefetch queries are broken into smaller
-                queries. The size of  is controlled by the DI property
-                Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY (the default number of conditions in
-                the generated WHERE clause is 10000). Cayenne will generate (1 + N * M) SQL
-                statements for each query using disjoint-by-ID prefetches, where N is the number of
-                relationships to prefetch, and M is the number of queries for a given prefetch that
-                is dependent on the number of objects in the result (ideally M = 1).</para>
-            <para>The advantage of this type of prefetch is that matching database rows by ID may be
-                much faster than matching the qualifier of the original query. Moreover this is
-                    <emphasis role="bold">the only type of prefetch</emphasis> that can handle
-                SelectQueries with <emphasis role="bold">fetch limit</emphasis>. Both joint and
-                regular disjoint prefetches may produce invalid results or generate inefficient
-                fetch-the-entire table SQL when fetch limit is in effect. </para>
-            <para>The disadvantage is that query SQL can get unwieldy for large result sets, as each
-                object will have to have its own condition in the WHERE clause of the generated
-                SQL.</para>
-        </section>
-        <section xml:id="joint-prefetch-semantics">
-            <title>Joint Prefetching Semantics</title>
-            <para>Joint semantics results in a single SQL statement for root objects and any number
-                of jointly prefetched paths. Cayenne processes in memory a cartesian product of the
-                entities involved, converting it to an object tree. It uses OUTER joins to connect
-                prefetched entities.</para>
-            <para>Joint is the most efficient prefetch type of the three as far as generated SQL
-                goes. There's always just 1 SQL query generated. Its downsides are the potentially
-                increased amount of data that needs to get across the network between the
-                application server and the database, and more data processing that needs to be done
-                on the Cayenne side.</para>
-        </section>
-    </section>
-    <section xml:id="datarows">
-        <title>Data Rows</title>
-        <para>Converting result set data to Persistent objects and registering these objects in the
-            ObjectContext can be an expensive operation compareable to the time spent running the
-            query (and frequently exceeding it). Internally Cayenne builds the result as a list of
-            DataRows, that are later converted to objects. Skipping the last step and using data in
-            the form of DataRows can significantly increase performance. </para>
-        <para>DataRow is a simply a map of values keyed by their DB column name. It is a ubiqutous
-            representation of DB data used internally by Cayenne. And it can be quite usable as is
-            in the application in many cases. So performance sensitive selects should consider
-            DataRows - it saves memory and CPU cycles. All selecting queries support DataRows
-            option,
-            e.g.:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-query.setFetchingDataRows(true);
-
-List&lt;DataRow> rows = context.performQuery(query); </programlisting><programlisting language="java">SQLTemplate query = new SQLTemplate(Artist.class, "SELECT * FROM ARTIST");
-query.setFetchingDataRows(true);
-
-List&lt;DataRow> rows = context.performQuery(query);</programlisting></para>
-        <para>Moreover DataRows may be converted to Persistent objects later as needed. So e.g. you
-            may implement some in-memory filtering, only converting a subset of fetched
-            objects:<programlisting language="java">// you need to cast ObjectContext to DataContext to get access to 'objectFromDataRow'
-DataContext dataContext = (DataContext) context;
-
-for(DataRow row : rows) {
-    if(row.get("DATE_OF_BIRTH") != null) {
-        Artist artist = dataContext.objectFromDataRow(Artist.class, row);
-        // do something with Artist...
-        ...
-    }
-}</programlisting></para>
-    </section>
-    <section xml:id="iterated-queries">
-        <title>Iterated Queries</title>
-        <para>While contemporary hardware may easily allow applications to fetch hundreds of
-            thousands or even millions of objects into memory, it doesn't mean this is always a good
-            idea to do so. You can optimize processing of very large result sets with two techniques
-            discussed in this and the following chapter - iterated and paginated queries. </para>
-        <para>Iterated query is not actually a special query. Any selecting query can be executed in
-            iterated mode by the DataContext (like in the previous example, a cast to DataContext is
-            needed). DataContext returns an object called <code>ResultIterator</code> that is backed
-            by an open ResultSet. Data is read from ResultIterator one row at a time until it is
-            exhausted. Data comes as a DataRows regardless of whether the orginating query was
-            configured to fetch DataRows or not. A ResultIterator must be explicitly closed to avoid
-            JDBC resource leak.</para>
-        <para>Iterated query provides constant memory performance for arbitrarily large ResultSets.
-            This is true at least on the Cayenne end, as JDBC driver may still decide to bring the
-            entire ResultSet into the JVM memory. </para>
-        <para>Here is a full
-            example:<programlisting language="java">// you need to cast ObjectContext to DataContext to get access to 'performIteratedQuery'
-DataContext dataContext = (DataContext) context;
-
-// create a regular query
-SelectQuery q = new SelectQuery(Artist.class);
-
-// ResultIterator operations all throw checked CayenneException
-// moreover 'finally' is required to close it
-try {
-
-    ResultIterator it = dataContext.performIteratedQuery(q);
-
-    try {
-        while(it.hasNextRow()) {
-            // normally we'd read a row, process its data, and throw it away
-            // this gives us constant memory performance
-            Map row = (Map) it.nextRow();
-            
-            // do something with the row...
-            ...
-        }
-    }
-    finally {
-        it.close();
-    }
-}
-catch(CayenneException e) {
-   e.printStackTrace();
-}
-</programlisting>Also
-            common sense tells us that ResultIterators should be processed and closed as soon as
-            possible to release the DB connection. E.g. storing open iterators between HTTP requests
-            and for unpredictable length of time would quickly exhaust the connection pool.</para>
-    </section>
-    <section xml:id="paginated-queries">
-        <title>Paginated Queries</title>
-        <para>Enabling query pagination allows to load very large result sets in a Java app with
-            very little memory overhead (much smaller than even the DataRows option discussed
-            above). Moreover it is completely transparent to the application - a user gets what
-            appears to be a list of Persistent objects - there's no iterator to close or DataRows to
-            convert to objects:</para>
-        <para>
-            <programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-query.setPageSize(50);
-
-// the fact that result is paginated is transparent
-List&lt;Artist> artists = ctxt.performQuery(query);</programlisting>
-        </para>
-        <para>Having said that, DataRows option can be combined with pagination, providing the best
-            of both
-            worlds:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-query.setPageSize(50);
-query.setFetchingDataRows(true);
-
-List&lt;DataRow> rows = ctxt.performQuery(query);</programlisting></para>
-        <para>The way pagination works internally, it first fetches a list of IDs for the root
-            entity of the query. This is very fast and initially takes very little memory. Then when
-            an object is requested at an arbitrary index in the list, this object and adjacent
-            objects (a "page" of objects that is determined by the query pageSize parameter) are
-            fetched together by ID. Subsequent requests to the objects of this "page" are served
-            from memory.</para>
-        <para>An obvious limitation of pagination is that if you eventually access all objects in
-            the list, the memory use will end up being the same as with no pagination. However it is
-            still a very useful approach. With some lists (e.g. multi-page search results) only a
-            few top objects are normally accessed. At the same time pagination allows to estimate
-            the full list size without fetching all the objects. And again - it is completely
-            transparent and looks like a normal query.</para>
-    </section>
-    <section xml:id="caching-and-fresh-data">
-        <title>Caching and Fresh Data</title>
-        <section xml:id="object-caching">
-            <title>Object Caching</title>
-        </section>
-        <section xml:id="query-result-caching">
-            <title>Query Result Caching</title>
-        </section>
-    </section>
-    <section xml:id="turning-off-synchronization-of-objectcontexts">
-        <title>Turning off Synchronization of ObjectContexts</title>
-        <para>By default when a single ObjectContext commits its changes, all other contexts in the
-            same runtime receive an event that contains all the committed changes. This allows them
-            to update their cached object state to match the latest committed data. There are
-            however many problems with this ostensibly helpful feature. In short - it works well in
-            environments with few contexts and in unclustered scenarios, such as single user desktop
-            applications, or simple webapps with only a few users. More specifically:<itemizedlist>
-                <listitem>
-                    <para>The performance of synchronization is (probably worse than) O(N) where N
-                        is the number of peer ObjectContexts in the system. In a typical webapp N
-                        can be quite large. Besides for any given context, due to locking on
-                        synchronization, context own performance will depend not only on the queries
-                        that it runs, but also on external events that it does not control. This is
-                        unacceptable in most situations. </para>
-                </listitem>
-                <listitem>
-                    <para>Commit events are untargeted - even contexts that do not hold a given
-                        updated object will receive the full event that they will have to
-                        process.</para>
-                </listitem>
-                <listitem>
-                    <para>Clustering between JVMs doesn't scale - apps with large volumes of commits
-                        will quickly saturate the network with events, while most of those will be
-                        thrown away on the receiving end as mentioned above.</para>
-                </listitem>
-                <listitem>
-                    <para>Some contexts may not want to be refreshed. A refresh in the middle of an
-                        operation may lead to unpredictable results. </para>
-                </listitem>
-                <listitem>
-                    <para>Synchronization will interfere with optimistic locking. </para>
-                </listitem>
-            </itemizedlist>So we've made a good case for disabling synchronization in most webapps.
-            To do that, set to "false" the following DI property -
-                <code>Constants.SERVER_CONTEXTS_SYNC_PROPERTY</code>, using one of the standard
-            Cayenne DI approaches. E.g. from command
-            line:<programlisting language="java">java -Dcayenne.server.contexts_sync_strategy=false</programlisting>Or
-            by changing the standard properties Map in a custom extensions
-            module:<programlisting language="java">public class MyModule implements Module {
-
-    @Override
-    public void configure(Binder binder) {
-        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY, "false");
-    }
-}</programlisting></para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml b/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
deleted file mode 100644
index 471cca1..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
+++ /dev/null
@@ -1,300 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="persistent-objects-objectcontext">
-    <title>Persistent Objects and ObjectContext</title>
-    <section xml:id="objectcontext">
-        <title>ObjectContext</title>
-        <para>ObjectContext is an interface that users normally work with to access the database. It
-            provides the API to execute database operations and to manage persistent objects. A
-            context is obtained from the
-            ServerRuntime:<programlisting language="java">ObjectContext context = runtime.getContext();</programlisting></para>
-        <para>The call above creates a new instance of ObjectContext that can access the database via this
-            runtime. ObjectContext is a single "work area" in Cayenne, storing persistent objects.
-            ObjectContext guarantees that for each database row with a unique ID it will contain at
-            most one instance of an object, thus ensuring object graph consistency between multiple
-            selects (a feature called "uniquing"). At the same time different ObjectContexts will
-            have independent copies of objects for each unique database row. This allows users to
-            isolate object changes from one another by using separate ObjectContexts.</para>
-        <para>These properties directly affect the strategies for scoping and sharing (or not
-            sharing) ObjectContexts. Contexts that are only used to fetch objects from the database
-            and whose objects are never modified by the application can be shared between mutliple
-            users (and multiple threads). Contexts that store modified objects should be accessed
-            only by a single user (e.g. a web application user might reuse a context instance
-            between multiple web requests in the same HttpSession, thus carrying uncommitted changes
-            to objects from request to request, until he decides to commit or rollback them). Even
-            for a single user it might make sense to use mutliple ObjectContexts (e.g.
-            request-scoped contexts to allow concurrent requests from the browser that change and
-            commit objects independently).</para>
-        <para>ObjectContext is serializable and does not permanently hold to any of the application
-            resources. So it does not have to be closed. If the context is not used anymore, it
-            should simply be allowed to go out of scope and get garbage collected, just like any
-            other Java object.</para>
-    </section>
-    <section xml:id="persistent-lifecycle">
-        <title>Persistent Object and its Lifecycle</title>
-        <para>Cayenne can persist Java objects that implement <code>org.apache.cayenne.Persistent</code>
-            interface. Generally persistent classes are generated from the model as described above,
-            so users do not have to worry about superclass and property implementation details. </para>
-        <para>Persistent interface provides access to 3 persistence-related properties - objectId,
-            persistenceState and objectContext. All 3 are initialized by Cayenne runtime framework.
-            Application code should not attempt to change them them. However it is allowed to read
-            them, which provides valuable runtime information. E.g. ObjectId can be used for quick
-            equality check of 2 objects, knowing persistence state would allow highlighting changed
-            objects, etc.</para>
-        <para>Each persistent object belongs to a single ObjectContext, and can be in one of the following
-            persistence states (as defined in <code>org.apache.cayenne.PersistenceState</code>)
-                :<table frame="void">
-                <caption>Persistence States</caption>
-                <col width="16%"/>
-                <col width="84%"/>
-                <tbody>
-                    <tr>
-                        <td>TRANSIENT</td>
-                        <td>The object is not registered with an ObjectContext and will not be
-                            persisted.</td>
-                    </tr>
-                    <tr>
-                        <td>NEW</td>
-                        <td>The object is freshly registered in an ObjectContext, but has not been
-                            saved to the database yet and there is no matching database row.</td>
-                    </tr>
-                    <tr>
-                        <td>COMMITTED</td>
-                        <td>The object is registered in an ObjectContext, there is a row in the
-                            database corresponding to this object, and the object state corresponds
-                            to the last known state of the matching database row.</td>
-                    </tr>
-                    <tr>
-                        <td>MODIFIED</td>
-                        <td>The object is registered in an ObjectContext, there is a row in the
-                            database corresponding to this object, but the object in-memory state
-                            has diverged from the last known state of the matching database
-                            row.</td>
-                    </tr>
-                    <tr>
-                        <td>HOLLOW</td>
-                        <td>The object is registered in an ObjectContext, there is a row in the
-                            database corresponding to this object, but the object state is unknown.
-                            Whenever an application tries to access a property of such object,
-                            Cayenne attempts reading its values from the database and "inflate" the
-                            object, turning it to COMMITED.</td>
-                    </tr>
-                    <tr>
-                        <td>DELETED</td>
-                        <td>The object is registered in an ObjectContext and has been marked for
-                            deletion in-memory. The corresponding row in the database will get
-                            deleted upon ObjectContext commit, and the object state will be turned
-                            into TRANSIENT.</td>
-                    </tr>
-                </tbody>
-            </table></para>
-    </section>
-    <section xml:id="persistent-operations">
-        <title>ObjectContext Persistence API</title>
-        <para>One of the first things users usually want to do with an ObjectContext is to select
-            some objects from a database. This is done by calling "<emphasis role="italic"
-                >performQuery</emphasis>"
-            method:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-List&lt;Artist> artists = context.performQuery(query);</programlisting>We'll
-            discuss queries in some detail in the following chapters. The example above is
-            self-explanatory - we create a SelectQuery that matches all Artist objects present in
-            the database, and then call "performQuery", getting a list of Artist objects.</para>
-        <para>Some queries can be quite complex, returning multiple result sets or even updating the
-            database. For such queries ObjectContext provides "<emphasis role="italic"
-                >performGenericQuery</emphasis>"method. While not nearly as commonly-used as
-            "performQuery", it is nevertheless important in some situations.
-            E.g.:<programlisting language="java">Collection&lt;Query> queries = ... // multiple queries that need to be run together
-QueryChain query = new QueryChain(queries);
-
-QueryResponse response = context.performGenericQuery(query);</programlisting></para>
-        <para>An application might modify selected objects. E.g.:</para>
-        <programlisting language="java">Artist selectedArtist = artists.get(0);
-selectedArtist.setName("Dali");</programlisting>
-        <para>The first time the object property is changed, the object's state is automatically set
-            to "MODIFIED" by Cayenne. Cayenne tracks all in-memory changes until a user calls
-                "<emphasis role="italic"
-            >commitChanges</emphasis>":<programlisting language="java">context.commitChanges();</programlisting>At
-            this point all in-memory changes are analyzed and a minimal set of SQL statements is
-            issued in a single transaction to synchronize the database with the in-memory state. In
-            our example "commitChanges" commits just one object, but generally it can be any number
-            of objects. </para>
-        <para>If instead of commit, we wanted to reset all changed objects to the previously
-            committed state, we'd call <emphasis>rollbackChanges</emphasis>
-            instead:<programlisting language="java">context.rollbackChanges();</programlisting></para>
-        <para>"<emphasis role="italic">newObject</emphasis>" method call creates a persistent object
-            and sets its state to
-            "NEW":<programlisting language="java">Artist newArtist = context.newObject(Artist.class);
-newArtist.setName("Picasso");</programlisting></para>
-        <para>It will only exist in memory until "commitChanges" is issued. On commit Cayenne might
-            generate a new primary key (unless a user set it explicitly, or a PK was inferred from a
-            relationship) and issue an INSERT SQL statement to permanently store the object.</para>
-        <para><emphasis>deleteObjects</emphasis> method takes one or more Persistent objects and
-            marks them as
-            "DELETED":<programlisting language="java">context.deleteObjects(artist1);
-context.deleteObjects(artist2, artist3, artist4);</programlisting>Additionally
-            "deleteObjects" processes all  delete rules modeled for the affected objects. This may
-            result in implicitly deleting or modifying extra related objects. Same as insert and
-            update, delete operations are sent to the database only when "commitChanges" is called.
-            Similarly "rollbackChanges" will undo the effect of "newObject" and
-            "deleteObjects".</para>
-        <para><emphasis>localObject</emphasis> returns a copy of a given persistent object that is
-            "local" to a given ObjectContext:</para>
-        <para>Since an application often works with more than one context, "localObject" is a rather
-            common operation. E.g. to improve performance a user might utilize a single shared
-            context to select and cache data, and then occasionally transfer some selected objects
-            to another context to modify and commit
-            them:<programlisting language="java">ObjectContext editingContext = runtime.getContext();
-Artist localArtist = editingContext.localObject(artist);</programlisting></para>
-        <para>Often an appliction needs to inspect mapping metadata. This information is stored in
-            the EntityResolver object, accessible via the
-            ObjectContext:<programlisting language="java">EntityResolver resolver = objectContext.getEntityResolver();</programlisting></para>
-        <para>Here we discussed the most commonly used subset of the ObjectContext API. There are
-            other useful methods, e.g. those allowing to inspect registered objects state en bulk,
-            etc. Check the latest JavaDocs for details.</para>
-    </section>
-    <section xml:id="cayenne-helper-class">
-        <title>Cayenne Helper Class</title>
-        <para>There is a useful helper class called "Cayenne" (fully-qualified name
-                <code>"org.apache.cayenne.Cayenne"</code>) that builds on ObjectContext API to
-            provide a number of very common operations. E.g. get a primary key (most entities do not
-            model PK as an object property)
-            :<programlisting language="java">long pk = Cayenne.longPKForObject(artist);</programlisting></para>
-        <para>It also provides the reverse operation - finding an object given a known
-            PK:<programlisting language="java">Artist artist = Cayenne.objectForPK(context, Artist.class, 34579);</programlisting></para>
-        <para>If a query is expected to return 0 or 1 object, Cayenne helper class can be used to find
-            this object. It throws an exception if more than one object matched the
-            query:<programlisting language="java">Artist artist = (Artist) Cayenne.objectForQuery(context, new SelectQuery(Artist.class));</programlisting></para>
-        <para>Feel free to explore Cayenne class API for other useful methods.</para>
-    </section>
-    <section xml:id="objectcontext-nesting">
-        <title>ObjectContext Nesting</title>
-        <para>In all the examples shown so far an ObjectContext would directly connect to a database
-            to select data or synchronize its state (either via commit or rollback). However another
-            context can be used in all these scenarios instead of a database. This concept is called
-            ObjectContext "nesting". Nesting is a parent/child relationship between two contexts,
-            where child is a nested context and selects or commits its objects via a parent. </para>
-        <para>Nesting is useful to create isolated object editing areas (child contexts) that need
-            to all be committed to an intermediate in-memory store (parent context), or rolled back
-            without affecting changes already recorded in the parent. Think cascading GUI dialogs,
-            or parallel AJAX requests coming to the same session.</para>
-        <para>In theory Cayenne supports any number of nesting levels, however applications should
-            generally stay with one or two, as deep hierarchies will most certainly degrade the
-            performance of the deeply nested child contexts. This is due to the fact that each
-            context in a nesting chain has to update its own objects during most operations. </para>
-        <para>Cayenne ROP is an extreme case of nesting when a child context is located in a
-            separate JVM and communicates with its parent via a web service. ROP is discussed in
-            details in the following chapters. Here we concentrate on the same-VM nesting.</para>
-        <para>To create a nested context, use an instance of ServerRuntime, passing it the desired
-            parent:<programlisting language="java">ObjectContext parent = runtime.getContext();
-ObjectContext nested = runtime.getContext((DataChannel) parent);</programlisting>From
-            here a nested context operates just like a regular context (you can perform queries,
-            create and delete objects, etc.). The only difference is that commit and rollback
-            operations can either be limited to synchronization with the parent, or cascade all the
-            way to the
-            database:<programlisting language="java">// merges nested context changes into the parent context
-nested.commitChangesToParent();
-
-// regular 'commitChanges' cascades commit through the chain 
-// of parent contexts all the way to the database
-nested.commitChanges();</programlisting><programlisting language="java">// unrolls all local changes, getting context in a state identical to parent
-nested.rollbackChangesLocally();
-
-// regular 'rollbackChanges' cascades rollback through the chain of contexts 
-// all the way to the topmost parent
-nested.rollbackChanges();</programlisting></para>
-    </section>
-    <section xml:id="generic-persistent-objects">
-        <title>Generic Persistent Objects</title>
-        <para>As described in the CayenneModeler chapter, Cayenne supports mapping of completely
-            generic classes to specific entities. Although for conveniece most applications should
-            stick with entity-specific class mappings, the generic feature offers some interesting
-            possibilities, such as creating mappings completely on the fly in a running application,
-            etc.</para>
-        <para>Generic objects are first class citizens in Cayenne, and all common persistent
-            operations apply to them as well. There are some pecularities however, described
-            below.</para>
-        <para>When creating a new generic object, either cast your ObjectContext to DataContext
-            (that provides "newObject(String)" API), or provide your object with an explicit
-            ObjectId:<programlisting language="java">DataObject generic = ((DataContext) context).newObject("GenericEntity");</programlisting><programlisting language="java">DataObject generic = new CayenneDataObject();
-generic.setObjectId(new ObjectId("GenericEntity"));
-context.registerNewObject(generic);</programlisting>SelectQuery
-            for generic object should be created passing entity name String in constructor, instead
-            of a Java
-            class:<programlisting language="java">SelectQuery query = new SelectQuery("GenericEntity");</programlisting>Use
-            DataObject API to access and modify properties of a generic
-            object:<programlisting language="java">String name = (String) generic.readProperty("name");
-generic.writeProperty("name", "New Name");</programlisting>This
-            is how an application can obtain entity name of a generic
-            object:<programlisting language="java">String entityName = generic.getObjectId().getEntityName();</programlisting></para>
-    </section>
-    <section xml:id="transactions">
-        <title>Transactions</title>
-        <para>Considering how much attention is given to managing transactions in most other ORMs,
-            transactions have been conspicuously absent from the ObjectContext discussion till now.
-            The reason is that transactions are seamless in Cayenne in all but a few special cases.
-            ObjectContext is an in-memory container of objects that is disconnected from the
-            database, except when it needs to run an operation. So it does not care about any
-            surrounding transaction scope. Sure enough all database operations are transactional, so
-            when an application does a commit, all SQL execution is wrapped in a database
-            transaction. But this is done behind the scenes and is rarely a concern to the
-            application code.</para>
-        <para>Two cases where transactions need to be taken into consideration are container-managed
-            and application-managed transactions. </para>
-        <para>If you are using an EJB container (or some other JTA environment), you'll likely need
-            to switch Cayenne runtime into "external transactions mode".  This is either done in the
-            Modeler (check DataDomain > 'Container-Managed Transactions' checkbox), or in the
-            code:<programlisting language="java">runtime.getDataDomain().setUsingExternalTransactions(true);</programlisting>In
-            this case Cayenne assumes that JDBC Connections obtained by runtime whenever that might
-            happen are all coming from a transactional DataSource managed by the container. In this
-            case Cayenne does not attempt to commit or rollback the connections, leaving it up to
-            the container to do that when appropriate.</para>
-        <para>In the second scenario, an application might need to define its own transaction scope
-            that spans more than one Cayenne operation. E.g. two sequential commits that need to be
-            rolled back together in case of failure. This can be done with an explicit thread-bound
-            transaction that surrounds a set of operations. Application is responsible for
-            committing or rolling it
-            back:<programlisting language="java">Transaction tx = runtime.getDataDomain().createTransaction();
-Transaction.bindThreadTransaction(tx);
-
-try {
-    // commit one or more contexts
-    context1.commitChanges();
-    context2.commitChanges();
-    ....
-    // after changing some objects in context1, commit again
-    context1.commitChnages();
-    ....
-    // if no failures, commit
-    tx.commit();
-}
-catch (Exception ex) {
-    tx.setRollbackOnly();
-}
-finally {
-    Transaction.bindThreadTransaction(null);
- 
-    if (tx.getStatus() == Transaction.STATUS_MARKED_ROLLEDBACK) {
-        try {
-           tx.rollback();
-        }
-        catch (Exception rollbackEx) {
-        }
-    }
-} </programlisting></para>
-    </section>
-</chapter>


[09/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/queries.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/queries.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/queries.adoc
new file mode 100644
index 0000000..f146ba2
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/queries.adoc
@@ -0,0 +1,691 @@
+// 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.
+
+=== Queries
+
+Queries are Java objects used by the application to communicate with the database. Cayenne knows how to translate queries into SQL statements appropriate for a particular database engine. Most often queries are used to find objects matching certain criteria, but there are other types of queries too. E.g. those allowing to run native SQL, call DB stored procedures, etc. When committing objects, Cayenne itself creates special queries to insert/update/delete rows in the database.
+
+There is a number of built-in queries in Cayenne, described later in this chapter. Most of the newer queries use fluent API and can be created and executed as easy-to-read one-liners. Users can define their own query types to abstract certain DB interactions that for whatever reason can not be adequately described by the built-in set.
+
+Queries can be roughly categorized as "object" and "native". Object queries (most notably ObjectSelect, SelectById, and EJBQLQuery) are built with abstractions originating in the object model (the "object" side in the "object-relational" divide). E.g. ObjectSelect is assembled from a Java class of the objects to fetch, a qualifier expression, orderings, etc. - all of this expressed in terms of the object model.
+
+Native queries describe a desired DB operation as SQL code (SQLSelect, SQLTemplate query) or a reference to a stored procedure (ProcedureQuery), etc. The results of native queries are usually presented as Lists of Maps, with each map representing a row in the DB (a term "data row" is often used to describe such a map). They can potentially be converted to objects, however it may take a considerable effort to do so. Native queries are also less (if at all) portable across databases than object queries.
+[[select]]
+==== SelectQuery
+
+SelectQuery is the most commonly used query in user applications. This may be the only query you will need in most appplications. It returns a list of persistent objects of a certain type specified in the query:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+List<Artist> objects = context.performQuery(query);
+----
+
+This returned all rows in the "ARTIST" table. If the logs were turned on, you might see the following SQL printed:
+
+----
+INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
+INFO: === returned 5 row. - took 5 ms.
+----
+
+This SQL was generated by Cayenne from the SelectQuery above. SelectQuery can have a qualifier to select only the data that you care about. Qualifier is simply an Expression (Expressions where discussed in the previous chapter). If you only want artists whose name begins with 'Pablo', you might use the following qualifier expression:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class,
+        ExpressionFactory.likeExp(Artist.NAME_PROPERTY, "Pablo%"));
+List<Artist> objects = context.performQuery(query);
+----
+
+The SQL will look different this time:
+
+----
+INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
+[bind: 1->NAME:'Pablo%']
+INFO: === returned 1 row. - took 6 ms.
+----
+
+SelectQuery allows to append parts of qualifier to self:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+query.setQualifier(ExpressionFactory.likeExp(Artist.NAME_PROPERTY, "A%"));
+query.andQualifier(ExpressionFactory.greaterExp(Artist.DATE_OF_BIRTH_PROPERTY, someDate));
+----
+
+To order the results of SelectQuery, one or more Orderings can be applied. Ordering were already discussed earlier. E.g.:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+
+// create Ordering object explicitly
+query.addOrdering(new Ordering(Artist.DATE_OF_BIRTH_PROPERTY, SortOrder.DESCENDING));
+
+// or let SelectQuery create it behind the scenes
+query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);
+----
+
+There's a number of other useful properties in SelectQuery that define what to select and how to optimize database interaction (prefetching, caching, fetch offset and limit, pagination, etc.). Some of them are discussed in separate chapters on caching and performance optimization. Others are fairly self-explanatory. Please check the API docs for the full extent of the SelectQuery features.
+
+[[ejbql]]
+==== EJBQLQuery
+
+EJBQLQuery was created as a part of an experiment in adopting some of Java Persistence API (JPA) approaches in Cayenne. It is a parameterized object query that is created from query String. A String used to build EJBQLQuery must conform to JPQL (JPA query language):
+
+
+[source, java]
+----
+EJBQLQuery query = new EJBQLQuery("select a FROM Artist a");
+----
+
+JPQL details can be found in any JPA manual. Here we'll mention only how this fits into Cayenne and what are the differences between EJBQL and other Cayenne queries.
+
+Although most frequently EJBQLQuery is used as an alternative to SelectQuery, there are also DELETE and UPDATE varieties available.
+
+NOTE: As of this version of Cayenne, DELETE and UPDATE do not change the state of objects in the ObjectContext. They are run directly against the database instead.
+
+
+[source, java]
+----
+EJBQLQuery select = new EJBQLQuery("select a FROM Artist a WHERE a.name = 'Salvador Dali'");
+List<Artist> artists = context.performQuery(select);
+----
+
+[source, java]
+----
+EJBQLQuery delete = new EJBQLQuery("delete from Painting");
+context.performGenericQuery(delete);
+----
+
+[source, java]
+----
+EJBQLQuery update = new EJBQLQuery("UPDATE Painting AS p SET p.name = 'P2' WHERE p.name = 'P1'");
+context.performGenericQuery(update);
+----
+
+
+In most cases SelectQuery is preferred to EJBQLQuery, as it is API-based, and provides you with better compile-time checks. However sometimes you may want a completely scriptable object query. This is when you might prefer EJBQL. A more practical reason for picking EJBQL over SelectQuery though is that the former offers some extra selecting capabilities, namely aggregate functions and subqueries:
+
+[source, java]
+----
+EJBQLQuery query = new EJBQLQuery("select a, COUNT(p) FROM Artist a JOIN a.paintings p GROUP BY a");
+List<Object[]> result = context.performQuery(query);
+for(Object[] artistWithCount : result) {
+    Artist a = (Artist) artistWithCount[0];
+    int hasPaintings = (Integer) artistWithCount[1];
+}
+----
+
+This also demonstrates a previously unseen type of select result - a List of Object[] elements, where each entry in an Object[] is either a DataObject or a scalar, depending on the query SELECT clause. A result can also be a list of scalars:
+
+[source, java]
+----
+EJBQLQuery query = new EJBQLQuery("select a.name FROM Artist a");
+List<String> names = context.performQuery(query);
+----
+
+While Cayenne Expressions discussed previously can be thought of as identical to JPQL WHERE clause, and indeed they are very close, there are a few noteable differences:
+
+- Null handling: SelectQuery would translate the expressions matching NULL values to the corresponding "X IS NULL" or "X IS NOT NULL" SQL syntax. EJBQLQuery on the other hand requires explicit "IS NULL" (or "IS NOT NULL") syntax to be used, otherwise the generated SQL will look like "X = NULL" (or "X <> NULL"), which will evaluate differently.
+
+- Expression Parameters: SelectQuery uses "$" to denote named parameters (e.g. "$myParam"), while EJBQL uses ":" (e.g. ":myParam"). Also EJBQL supports positional parameters denoted by the question mark: "?3".
+
+[[sqltemplate]]
+==== SQLTemplate
+SQLTemplate is a query that allows to run native SQL from a Cayenne application. It comes handy when the standard ORM concepts are not sufficient for a given query or an update. SQL is too powerful and allows to manipulate data in ways that are not easily described as a graph of related entities. Cayenne acknowledges this fact and provides this facility to execute SQL, mapping the result to objects when possible. Here are examples of selecting and non-selecting SQLTemplates:
+
+
+[source, java]
+----
+SQLTemplate select = new SQLTemplate(Artist.class, "select * from ARTIST");
+List<Artist> result = context.performQuery(select);
+----
+
+[source, java]
+----
+SQLTemplate update = new SQLTemplate(Artist.class, "delete from ARTIST");
+QueryResponse response = context.performGenericQuery(update);
+----
+
+Cayenne doesn't make any attempt to make sense of the SQL semantics, so it doesn't know whether a given query is performing a select or update, etc. It is the the user's decision to run a given query as a selecting or "generic".
+
+NOTE: Any data modifications done to DB as a result of SQLTemplate execution do not change the state of objects in the ObjectContext. So some objects in the context may become stale as a result.
+
+Another point to note is that the first argument to the SQLTemplate constructor - the Java class - has the same meaning as in SelectQuery only when the result can be converted to objects (e.g. when this is a selecting query and it is selecting all columns from one table). In this case it denotes the "root" entity of this query result. If the query does not denote a single entity result, this argument is only used for query routing, i.e. determining which database it should be run against. You are free to use any persistent class or even a DataMap instance in such situation. It will work as long as the passed "root" maps to the same database as the current query.
+
+To achieve interoperability between mutliple RDBMS a user can specify multiple SQL statements for the same SQLTemplate, each corresponding to a native SQL dialect. A key used to look up the right dialect during execution is a fully qualified class name of the corresponding DbAdapter. If no DB-specific statement is present for a given DB, a default generic statement is used. E.g. in all the examples above a default statement will be used regardless of the runtime database. So in most cases you won't need to explicitly "translate" your SQL to all possible dialects. Here is how this works in practice:
+
+[source, java]
+----
+SQLTemplate select = new SQLTemplate(Artist.class, "select * from ARTIST");
+
+// For Postgres it would be nice to trim padding of all CHAR columns.
+// Otherwise those will be returned with whitespace on the right.
+// assuming "NAME" is defined as CHAR...
+String pgSQL = "SELECT ARTIST_ID, RTRIM(NAME), DATE_OF_BIRTH FROM ARTIST";
+query.setTemplate(PostgresAdapter.class.getName(), pgSQL);
+----
+
+===== Scripting SQLTemplate with Velocity
+
+The most interesting aspect of SQLTemplate (and the reason why it is called a "template") is that a SQL string is treated by Cayenne as an Apache Velocity template. Before sending it to DB as a PreparedStatement, the String is evaluated in the Velocity context, that does variable substitutions, and performs special callbacks in response to various directives, thus controlling query interaction with the JDBC layer.
+
+Check Velocity docs for the syntax details. Here we'll just mention the two main scripting elements - "variables" (that look like `$var`) and "directives" (that look like `#directive(p1 p2 p3)`). All built-in Velocity directives are supported. Additionally Cayenne defines a number of its own directives to bind parameters to PreparedStatements and to control the structure of the ResultSet. These directives are described in the following sections.
+
+
+===== Variable Substitution
+
+All variables in the template string are replaced from query parameters:
+
+
+[source, java]
+----
+SQLTemplate query = new SQLTemplate(Artist.class, "delete from $tableName");
+query.setParameters(Collections.singletonMap("tableName", "mydb.PAINTING"));
+
+// this will generate SQL like this: "delete from mydb.PAINTING"
+----
+
+The example above demonstrates the point made earlier in this chapter - even if we don't know upfront which table the query will run against, we can still use a fixed "root" in constructor (`Artist.class` in this case) , as we are not planning on converting the result to objects.
+
+Variable substitution within the text uses `"object.toString()"` method to replace the variable value. Keep in mind that this may not be appropriate in all situations. E.g. passing a date object in a WHERE clause expression may be converted to a String not understood by the target RDBMS SQL parser. In such cases variable should be wrapped in `#bind` directive as described below.
+
+[[directives]]
+===== Directives
+
+These are the Cayenne directives used to customize SQLTemplate parsing and integrate it with the JDBC layer:
+
+====== #bind
+
+Creates a PreparedStatement positional parameter in place of the directive, binding the value to it before statement execution. `#bind` is allowed in places where a "?" would be allowed in a PreparedStatement. And in such places it almost always makes sense to pass objects to the template via this or other forms of #bind instead of inserting them inline.
+
+Semantics:
+
+[source]
+----
+#bind(value)
+#bind(value jdbcType)
+#bind(value jdbcType scale)
+----
+
+Arguments:
+
+- `value` - can either be a char constant or a variable that is resolved from the query parameters. Note that the variable can be a collection, that will be automatically expanded into a list of individual value bindings. This is useful for instance to build IN conditions.
+
+- `jdbcType` - is a JDBC data type of the parameter as defined in `java.sql.Types`.
+
+- `scale` - An optional scale of the numeric value. Same as "scale" in PreparedStatement.
+
+Usage:
+
+[source]
+----
+#bind($xyz)
+#bind('str')
+#bind($xyz 'VARCHAR')
+#bind($xyz 'DECIMAL' 2)
+----
+
+Full example:
+
+[source, SQL]
+----
+update ARTIST set NAME = #bind($name) where ID = #bind($id)
+----
+
+
+====== #bindEqual
+
+Same as #bind, but also includes the "=" sign in front of the value binding. Look at the example below - we took the #bind example and replaced `"ID = #bind(..)"` with `"ID #bindEqual(..)"`. While it looks like a clumsy shortcut to eliminate the equal sign, the actual reason why this is useful is that it allows the value to be null. If the value is not null, `"= ?"` is generated, but if it is, the resulting chunk of the SQL would look like `"IS NULL"` and will be compilant with what the DB expects.
+
+Semantics:
+
+
+[source]
+----
+#bindEqual(value)
+#bindEqual(value jdbcType)
+#bindEqual(value jdbcType scale)
+----
+
+Arguments: (same as #bind)
+
+Usage:
+
+[source]
+----
+#bindEqual($xyz)
+#bindEqual('str')
+#bindEqual($xyz 'VARCHAR')
+#bindEqual($xyz 'DECIMAL' 2)
+----
+
+
+Full example:
+
+
+[source, SQL]
+----
+update ARTIST set NAME = #bind($name) where ID #bindEqual($id)
+----
+
+====== #bindNotEqual
+
+This directive deals with the same issue as `#bindEqual` above, only it generates "not equal" in front of the value (or IS NOT NULL).
+
+Semantics:
+
+[source]
+----
+#bindNotEqual(value)
+#bindNotEqual(value jdbcType)
+#bindNotEqual(value jdbcType scale)
+----
+
+Arguments: (same as #bind)
+
+Usage:
+
+[source]
+----
+#bindNotEqual($xyz)
+#bindNotEqual('str')
+#bindNotEqual($xyz 'VARCHAR')
+#bindNotEqual($xyz 'DECIMAL' 2)
+----
+
+Full example:
+
+
+[source, SQL]
+----
+update ARTIST set NAME = #bind($name) where ID #bindEqual($id)
+----
+
+====== #bindObjectEqual
+
+It can be tricky to use a Persistent object or an ObjectId in a binding, especially for tables with compound primary keys. This directive helps to handle such binding. It maps columns in the query to the names of Persistent object ID columns, extracts ID values from the object, and generates SQL like "COL1 = ? AND COL2 = ? ..." , binding positional parameters to ID values. It can also correctly handle null object. Also notice how we are specifying a Velocity array for multi-column PK.
+
+Semantics:
+
+[source]
+----
+#bindObjectEqual(value columns idColumns)
+----
+
+Arguments:
+
+- `value` - must be a variable that is resolved from the query parameters to a Persistent or ObjectId.
+
+- `columns` - the names of the columns to generate in the SQL.
+
+- `idColumn` - the names of the ID columns for a given entity. Must match the order of "columns" to match against.
+
+Usage:
+
+[source]
+----
+#bindObjectEqual($a 't0.ID' 'ID')
+#bindObjectEqual($b ['t0.FK1', 't0.FK2'] ['PK1', 'PK2'])
+----
+
+Full example:
+
+[source, java]
+----
+String sql = "SELECT * FROM PAINTING t0 WHERE #bindObjectEqual($a 't0.ARTIST_ID' 'ARTIST_ID' ) ORDER BY PAINTING_ID";
+SQLTemplate select = new SQLTemplate(Artist.class, sql);
+
+Artist a = ....
+select.setParameters(Collections.singletonMap("a", a));
+----
+
+====== #bindObjectNotEqual
+
+Same as #bindObjectEqual above, only generates "not equal" operator for value comparison (or IS NOT NULL).
+
+Semantics:
+
+[source]
+----
+#bindObjectNotEqual(value columns idColumns)
+----
+
+Arguments: (same as #bindObjectEqual)
+
+Usage:
+
+[source]
+----
+#bindObjectNotEqual($a 't0.ID' 'ID')
+#bindObjectNotEqual($b ['t0.FK1', 't0.FK2'] ['PK1', 'PK2'])
+----
+
+Full example:
+
+[source, java]
+----
+String sql = "SELECT * FROM PAINTING t0 WHERE #bindObjectNotEqual($a 't0.ARTIST_ID' 'ARTIST_ID' ) ORDER BY PAINTING_ID";
+SQLTemplate select = new SQLTemplate(Artist.class, sql);
+
+Artist a = ....
+select.setParameters(Collections.singletonMap("a", a));
+----
+
+====== #result
+
+Renders a column in SELECT clause of a query and maps it to a key in the result DataRow. Also ensures the value read is of the correct type. This allows to create a DataRow (and ultimately - a persistent object) from an arbitrary ResultSet.
+
+Semantics:
+
+[source]
+----
+#result(column)
+#result(column javaType)
+#result(column javaType alias)
+#result(column javaType alias dataRowKey)
+----
+
+Arguments:
+
+- `column` - the name of the column to render in SQL SELECT clause.
+
+- `javaType` - a fully-qualified Java class name for a given result column. For simplicity most common Java types used in JDBC can be specified without a package. These include all numeric types, primitives, String, SQL dates, BigDecimal and BigInteger. So `"#result('A' 'String')"`, `"#result('B' 'java.lang.String')"` and `"#result('C' 'int')"` are all valid
+
+- `alias` - specifies both the SQL alias of the column and the value key in the DataRow. If omitted, "column" value is used.
+
+- `dataRowKey` - needed if SQL 'alias' is not appropriate as a DataRow key on the Cayenne side. One common case when this happens is when a DataRow retrieved from a query is mapped using joint prefetch keys (see below). In this case DataRow must use database path expressions for joint column keys, and their format is incompatible with most databases alias format.
+
+Usage:
+
+[source]
+----
+#result('NAME')
+#result('DATE_OF_BIRTH' 'java.util.Date')
+#result('DOB' 'java.util.Date' 'DATE_OF_BIRTH')
+#result('DOB' 'java.util.Date' '' 'artist.DATE_OF_BIRTH')
+#result('SALARY' 'float')
+----
+
+Full example:
+
+
+[source, SQL]
+----
+SELECT #result('ID' 'int'), #result('NAME' 'String'), #result('DATE_OF_BIRTH' 'java.util.Date') FROM ARTIST
+----
+
+====== #chain and #chunk
+
+`#chain` and `#chunk` directives are used for conditional inclusion of SQL code. They are used together with `#chain` wrapping multiple `#chunks`. A chunk evaluates its parameter expression and if it is NULL suppresses rendering of the enclosed SQL block. A chain renders its prefix and its chunks joined by the operator. If all the chunks are suppressed, the chain itself is suppressed. This allows to work with otherwise hard to script SQL semantics. E.g. a WHERE clause can contain multiple conditions joined with AND or OR. Application code would like to exclude a condition if its right-hand parameter is not present (similar to Expression pruning discussed above). If all conditions are excluded, the entire WHERE clause should be excluded. chain/chunk allows to do that.
+
+Semantics:
+
+[source]
+----
+#chain(operator) ... #end
+#chain(operator prefix) ... #end
+#chunk() ... #end
+#chunk(param) ... #end
+----
+
+Full example:
+
+[source]
+----
+#chain('OR' 'WHERE')
+	#chunk($name) NAME LIKE #bind($name) #end"
+	#chunk($id) ARTIST_ID > #bind($id) #end"
+#end"
+----
+
+====== Mapping SQLTemplate Results
+
+Here we'll discuss how to convert the data selected via SQLTemplate to some useable format, compatible with other query results. It can either be very simple or very complex, depending on the structure of the SQL, JDBC driver nature and the desired result structure. This section presents various tips and tricks dealing with result mapping.
+
+By default SQLTemplate is expected to return a List of Persistent objects of its root type. This is the simple case:
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate(Artist.class, "SELECT * FROM ARTIST");
+
+// List of Artists
+List<Artist> artists = context.performQuery(query);
+----
+
+Just like SelectQuery, SQLTemplate can fetch DataRows. In fact DataRows option is very useful with SQLTemplate, as the result type most often than not does not represent a Cayenne entity, but instead may be some aggregated report or any other data whose object structure is opaque to Cayenne:
+
+[source, Java]
+----
+String sql = "SELECT t0.NAME, COUNT(1) FROM ARTIST t0 JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) "
+    + "GROUP BY t0.NAME ORDER BY COUNT(1)";
+SQLTemplate query = new SQLTemplate(Artist.class, sql);
+
+// ensure we are fetching DataRows
+query.setFetchingDataRows(true);
+
+// List of DataRow
+List<DataRow> rows = context.performQuery(query);
+----
+
+In the example above, even though the query root is Artist. the result is a list of artist names with painting counts (as mentioned before in such case "root" is only used to find the DB to fetch against, but has no bearning on the result). The DataRows here are the most appropriate and desired result type.
+
+In a more advanced case you may decide to fetch a list of scalars or a list of Object[] with each array entry being either an entity or a scalar. You probably won't be doing this too often and it requires quite a lot of work to setup, but if you want your SQLTemplate to return results similar to EJBQLQuery, it is doable using SQLResult as described below:
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate(Painting.class, "SELECT ESTIMATED_PRICE P FROM PAINTING");
+
+// let Cayenne know that result is a scalar
+SQLResult resultDescriptor = new SQLResult();
+resultDescriptor.addColumnResult("P");
+query.setResult(resultDescriptor);
+
+// List of BigDecimals
+List<BigDecimal> prices = context.performQuery(query);
+----
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate(Artist.class, "SELECT t0.ID, t0.NAME, t0.DATE_OF_BIRTH, COUNT(t1.PAINTING_ID) C " +
+      "FROM ARTIST t0 LEFT JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) " +
+      "GROUP BY t0.ID, t0.NAME, t0.DATE_OF_BIRTH");
+
+// let Cayenne know that result is a mix of Artist objects and the count of their paintings
+EntityResult artistResult = new EntityResult(Artist.class);
+artistResult.addDbField(Artist.ID_PK_COLUMN, "ARTIST_ID");
+artistResult.addObjectField(Artist.NAME_PROPERTY, "NAME");
+artistResult.addObjectField(Artist.DATE_OF_BIRTH_PROPERTY, "DATE_OF_BIRTH");
+
+SQLResult resultDescriptor = new SQLResult();
+resultDescriptor.addEntityResult(artistResult);
+resultDescriptor.addColumnResult("C");
+query.setResult(resultDescriptor);
+
+// List of Object[]
+List<Object[]> data = context.performQuery(query);
+----
+
+Another trick related to mapping result sets is making Cayenne recognize prefetched entities in the result set. This emulates "joint" prefetching of SelectQuery, and is achieved by special column naming. Columns belonging to the "root" entity of the query should use unqualified names corresponding to the root DbEntity columns. For each related entity column names must be prefixed with relationship name and a dot (e.g. "toArtist.ID"). Column naming can be controlled with "#result" directive:
+
+[source, Java]
+----
+String sql = "SELECT distinct "
+    + "#result('t1.ESTIMATED_PRICE' 'BigDecimal' '' 'paintings.ESTIMATED_PRICE'), "
+    + "#result('t1.PAINTING_TITLE' 'String' '' 'paintings.PAINTING_TITLE'), "
+    + "#result('t1.GALLERY_ID' 'int' '' 'paintings.GALLERY_ID'), "
+    + "#result('t1.ID' 'int' '' 'paintings.ID'), "
+    + "#result('NAME' 'String'), "
+    + "#result('DATE_OF_BIRTH' 'java.util.Date'), "
+    + "#result('t0.ID' 'int' '' 'ID') "
+    + "FROM ARTIST t0, PAINTING t1 "
+    + "WHERE t0.ID = t1.ARTIST_ID";
+
+SQLTemplate q = new SQLTemplate(Artist.class, sql);
+q.addPrefetch(Artist.PAINTINGS_PROPERTY)
+List<Artist> objects = context.performQuery(query);
+----
+
+And the final tip deals with capitalization of the DataRow keys. Queries like `"SELECT * FROM..."` and even `"SELECT COLUMN1, COLUMN2, ... FROM ..."` can sometimes result in Cayenne exceptions on attempts to convert fetched DataRows to objects. Essentially any query that is not using a `#result` directive to describe the result set is prone to this problem, as different databases may produce different capitalization of the java.sql.ResultSet columns.
+
+The most universal way to address this issue is to describe each column explicitly in the SQLTemplate via `#result`, e.g.: `"SELECT #result('column1'), #result('column2'), .."`. However this quickly becomes impractical for tables with lots of columns. For such cases Cayenne provides a shortcut based on the fact that an ORM mapping usually follows some naming convention for the column names. Simply put, for case-insensitive databases developers normally use either all lowercase or all uppercase column names. Here is the API that takes advantage of that user knowledge and forces Cayenne to follow a given naming convention for the DataRow keys (this is also available as a dropdown in the Modeler):
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate("SELECT * FROM ARTIST");
+query.setColumnNamesCapitalization(CapsStrategy.LOWER);
+List objects = context.performQuery(query);
+----
+
+or
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate("SELECT * FROM ARTIST");
+query.setColumnNamesCapitalization(CapsStrategy.UPPER);
+List objects = context.performQuery(query);
+----
+
+None of this affects the generated SQL, but the resulting DataRows are using correct capitalization. Note that you probably shouldn't bother with this unless you are getting CayenneRuntimeExceptions when fetching with SQLTemplate.
+
+==== ProcedureQuery
+
+Stored procedures are mapped as separate objects in CayenneModeler. ProcedureQuery provides a way to execute them with a certain set of parameters. Just like with SQLTemplate, the outcome of a procedure can be anything - a single result set, mutliple result sets, some data modification (returned as an update count), or a combination of these. So use "performQuery" to get a single result set, and use "performGenericQuery" for anything else:
+
+[source, java]
+----
+ProcedureQuery query = new ProcedureQuery("my_procedure", Artist.class);
+
+// Set "IN" parameter values
+query.addParam("p1", "abc");
+query.addParam("p2", 3000);
+
+List<Artist> result = context.performQuery(query);
+----
+
+[source, java]
+----
+// here we do not bother with root class.
+// Procedure name gives us needed routing information
+ProcedureQuery query = new ProcedureQuery("my_procedure");
+
+query.addParam("p1", "abc");
+query.addParam("p2", 3000);
+
+QueryResponse response = context.performGenericQuery(query);
+----
+A stored procedure can return data back to the application as result sets or via OUT parameters. To simplify the processing of the query output, QueryResponse treats OUT parameters as if it was a separate result set. If a stored procedure declares any OUT or INOUT parameters, QueryResponse will contain their returned values in the very first result list:
+
+[source, java]
+----
+ProcedureQuery query = new ProcedureQuery("my_procedure");
+QueryResponse response = context.performGenericQuery(query);
+
+// read OUT parameters
+List out = response.firstList();
+
+if(!out.isEmpty()) {
+    Map outParameterValues = (Map) outList.get(0);
+}
+----
+
+There maybe a situation when a stored procedure handles its own transactions, but an application is configured to use Cayenne-managed transactions. This is obviously conflicting and undesirable behavior. In this case ProcedureQueries should be executed explicitly wrapped in an "external" Transaction. This is one of the few cases when a user should worry about transactions at all. See Transactions section for more details.
+
+==== NamedQuery
+
+NamedQuery is a query that is a reference to another query stored in the DataMap. The actual stored query can be SelectQuery, SQLTemplate, EJBQLQuery, etc. It doesn't matter - the API for calling them is the same - via a NamedQuery:
+
+[source, java]
+----
+String[] keys = new String[] {"loginid", "password"};
+Object[] values = new String[] {"joe", "secret"};
+
+NamedQuery query = new NamedQuery("Login", keys, values);
+
+List<User> matchingUsers = context.performQuery(query);
+----
+
+==== Custom Queries
+
+If a user needs some extra functionality not addressed by the existing set of Cayenne queries, he can write his own. The only requirement is to implement `org.apache.cayenne.query.Query` interface. The easiest way to go about it is to subclass some of the base queries in Cayenne.
+
+E.g. to do something directly in the JDBC layer, you might subclass AbstractQuery:
+
+[source, java]
+----
+public class MyQuery extends AbstractQuery {
+
+    @Override
+    public SQLAction createSQLAction(SQLActionVisitor visitor) {
+        return new SQLAction() {
+
+            @Override
+            public void performAction(Connection connection, OperationObserver observer) throws SQLException, Exception {
+                // 1. do some JDBC work using provided connection...
+                // 2. push results back to Cayenne via OperationObserver
+            }
+        };
+    }
+}
+----
+
+To delegate the actual query execution to a standard Cayenne query, you may subclass IndirectQuery:
+
+[source, java]
+----
+public class MyDelegatingQuery extends IndirectQuery {
+
+    @Override
+    protected Query createReplacementQuery(EntityResolver resolver) {
+        SQLTemplate delegate = new SQLTemplate(SomeClass.class, generateRawSQL());
+        delegate.setFetchingDataRows(true);
+        return delegate;
+    }
+
+    protected String generateRawSQL() {
+        // build some SQL string
+    }
+}
+----
+
+In fact many internal Cayenne queries are IndirectQueries, delegating to SelectQuery or SQLTemplate after some preprocessing.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/starting.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/starting.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/starting.adoc
new file mode 100644
index 0000000..aff8b91
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/starting.adoc
@@ -0,0 +1,120 @@
+// 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.
+
+=== Starting Cayenne
+
+==== Starting and Stopping ServerRuntime
+
+In runtime Cayenne is accessed via `org.apache.cayenne.configuration.server.ServerRuntime`. ServerRuntime is created by calling a convenient builder:
+
+[source, java]
+----
+ServerRuntime runtime = new ServerRuntime("com/example/cayenne-project.xml");
+----
+
+The parameter you pass to the builder is a location of the main project file. Location is a '/'-separated path (same path separator is used on UNIX and Windows) that is resolved relative to the application classpath. The project file can be placed in the root package or in a subpackage (e.g. in the code above it is in "com/example" subpackage).
+
+ServerRuntime encapsulates a single Cayenne stack. Most applications will just have one ServerRuntime using it to create as many ObjectContexts as needed, access the Dependency Injection (DI) container and work with other Cayenne features. Internally ServerRuntime is just a thin wrapper around the DI container. Detailed features of the container are discussed in xref:customize["Customizing Cayenne Runtime"] chapter. Here we'll just show an example of how an application might turn on external transactions:
+
+[source, java]
+----
+public class MyExtensionsModule implements Module {
+    public void configure(Binder binder) {
+        binder.bind(QueryCache.class).to(EhCacheQueryCache.class);
+    }
+}
+----
+
+[source, java]
+----
+Module extensions = new MyExtensionsModule();
+ServerRuntime runtime = new ServerRuntime("com/example/cayenne-project.xml", extensions);
+----
+
+It is a good idea to shut down the runtime when it is no longer needed, usually before the application itself is shutdown:
+
+[source, java]
+----
+runtime.shutdown();
+----
+
+When a runtime object has the same scope as the application, this may not be always necessary, however in some cases it is essential, and is generally considered a good practice. E.g. in a web container hot redeploy of a webapp will cause resource leaks and eventual OutOfMemoryError if the application fails to shutdown CayenneRuntime.
+
+==== Merging Multiple Projects
+
+ServerRuntime requires at least one mapping project to run. But it can also take multiple projects and merge them together in a single configuration. This way different parts of a database can be mapped independenlty from each other (even by different software providers), and combined in runtime when assembling an application. Doing it is as easy as passing multiple project locations to ServerRuntime constructor:
+
+[source, java]
+----
+ServerRuntime runtime = new ServerRuntime(new String[] {
+        "com/example/cayenne-project.xml",
+        "org/foo/cayenne-library1.xml",
+        "org/foo/cayenne-library2.xml"
+    }
+);
+----
+
+When the projects are merged, the following rules are applied:
+
+
+- The order of projects matters during merge. If there are two conflicting metadata objects belonging to two projects, an object from the last project takes precedence over the object from the first one. This makes possible to override pieces of metadata. This is also similar to how DI modules are merged in Cayenne.
+
+- Runtime DataDomain name is set to the name of the last project in the list.
+
+- Runtime DataDomain properties are the same as the properties of the last project in the list. I.e. properties are not merged to avoid invalid combinations and unexpected runtime behavior.
+
+- If there are two or more DataMaps with the same name, only one DataMap is used in the merged project, the rest are discarded. Same precedence rules apply - DataMap from the project with the highest index in the project list overrides all other DataMaps with the same name.
+
+- If there are two or more DataNodes with the same name, only one DataNode is used in the merged project, the rest are discarded. DataNode coming from project with the highest index in the project list is chosen per precedence rule above.
+
+- There is a notion of "default" DataNode. After the merge if any DataMaps are not explicitly linked to DataNodes, their queries will be executed via a default DataNode. This makes it possible to build mapping "libraries" that are only associated with a specific database in runtime. If there's only one DataNode in the merged project, it will be automatically chosen as default. A possible way to explicitly designate a specific node as default is to override `DataDomainProvider.createAndInitDataDomain()`.
+
+==== Web Applications
+
+Web applications can use a variety of mechanisms to configure and start the "services" they need, Cayenne being one of such services. Configuration can be done within standard Servlet specification objects like Servlets, Filters, or ServletContextListeners, or can use Spring, JEE CDI, etc. This is a user's architectural choice and Cayenne is agnostic to it and will happily work in any environment. As described above, all that is needed is to create an instance of ServerRuntime somewhere and provide the application code with means to access it. And shut it down when the application ends to avoid container leaks.
+
+Still Cayenne includes a piece of web app configuration code that can assist in quickly setting up simple Cayenne-enabled web applications. We are talking about CayenneFilter. It is declared in web.xml:
+
+[source, XML]
+----
+<web-app>
+    ...
+    <filter>
+        <filter-name>cayenne-project</filter-name>
+        <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
+    </filter>
+     <filter-mapping>
+        <filter-name>cayenne-project</filter-name>
+        <url-pattern>/*</url-pattern>
+     </filter-mapping>
+    ...
+ </web-app>
+----
+
+
+When started by the web container, it creates a instance of ServerRuntime and stores it in the ServletContext. Note that the name of Cayenne XML project file is derived from the "filter-name". In the example above CayenneFilter will look for an XML file "cayenne-project.xml". This can be overridden with "configuration-location" init parameter.
+
+When the application runs, all HTTP requests matching the filter url-pattern will have access to a session-scoped ObjectContext like this:
+
+[source, java]
+----
+ ObjectContext context = BaseContext.getThreadObjectContext();
+----
+
+Of course the ObjectContext scope, and other behavior of the Cayenne runtime can be customized via dependency injection. For this another filter init parameter called "extra-modules" is used. "extra-modules" is a comma or space-separated list of class names, with each class implementing Module interface. These optional custom modules are loaded after the the standard ones, which allows users to override all standard definitions.
+
+For those interested in the DI container contents of the runtime created by CayenneFilter, it is the same ServerRuntime as would've been created by other means, but with an extra `org.apache.cayenne.configuration.web.WebModule` module that provides `org.apache.cayenne.configuration.web.RequestHandler` service. This is the service to override in the custom modules if you need to provide a different ObjectContext scope, etc.
+
+NOTE: You should not think of CayenneFilter as the only way to start and use Cayenne in a web application. In fact CayenneFilter is entirely optional. Use it if you don't have any special design for application service management. If you do, simply integrate Cayenne into that design.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/tuning.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/tuning.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/tuning.adoc
new file mode 100644
index 0000000..e9316b1
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/tuning.adoc
@@ -0,0 +1,269 @@
+// 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.
+
+=== Performance Tuning
+
+==== Prefetching
+
+Prefetching is a technique that allows to bring back in one query not only the queried objects, but also objects related to them. In other words it is a controlled eager relationship resolving mechanism. Prefetching is discussed in the "Performance Tuning" chapter, as it is a powerful performance optimization method. However another common application of prefetching is to refresh stale object relationships, so more generally it can be viewed as a technique for managing subsets of the object graph.
+
+Prefetching example:
+
+[source, Java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+
+// this instructs Cayenne to prefetch one of Artist's relationships
+query.addPrefetch("paintings");
+
+// query is expecuted as usual, but the resulting Artists will have
+// their paintings "inflated"
+List<Artist> artists = context.performQuery(query);
+----
+
+All types of relationships can be preftetched - to-one, to-many, flattened.
+
+A prefetch can span multiple relationships:
+
+[source, Java]
+----
+ query.addPrefetch("paintings.gallery");
+----
+
+A query can have multiple prefetches:
+
+[source, Java]
+----
+query.addPrefetch("paintings");
+query.addPrefetch("paintings.gallery");
+----
+
+If a query is fetching DataRows, all "disjoint" prefetches are ignored, only "joint" prefetches are executed (see prefetching semantics discussion below for what disjoint and joint prefetches mean).
+
+===== Prefetching Semantics
+
+Prefetching semantics defines a strategy to prefetch relationships. Depending on it, Cayenne would generate different types of queries. The end result is the same - query root objects with related objects fully resolved. However semantics can affect preformance, in some cases significantly. There are 3 types of prefetch semantics, all defined as constants in `org.apache.cayenne.query.PrefetchTreeNode`:
+
+[source]
+----
+PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS
+PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS
+PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS
+----
+
+Each query has a default prefetch semantics, so generally users do not have to worry about changing it, except when performance is a concern, or a few special cases when a default sematics can't produce the correct result. SelectQuery uses DISJOINT_PREFETCH_SEMANTICS by default. Semantics can be changed as follows:
+
+[source, java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+query.addPrefetch("paintings").setSemantics(
+                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
+----
+
+There's no limitation on mixing different types of semantics in the same SelectQuery. Multiple prefetches each can have its own semantics.
+
+SQLTemplate and ProcedureQuery are both using JOINT_PREFETCH_SEMANTICS and it can not be changed due to the nature of these two queries.
+
+
+===== Disjoint Prefetching Semantics
+
+This semantics results in Cayenne generatiing one SQL statement for the main objects, and a separate statement for each prefetch path (hence "disjoint" - related objects are not fetched with the main query). Each additional SQL statement uses a qualifier of the main query plus a set of joins traversing the preftech path between the main and related entity.
+
+This strategy has an advantage of efficient JVM memory use, and faster overall result processing by Cayenne, but it requires (1+N) SQL statements to be executed, where N is the number of prefetched relationships.
+
+===== Disjoint-by-ID Prefetching Semantics
+
+This is a variation of disjoint prefetch where related objects are matched against a set of IDs derived from the fetched main objects (or intermediate objects in a multi-step prefetch). Cayenne limits the size of the generated WHERE clause, as most DBs can't parse arbitrary large SQL. So prefetch queries are broken into smaller queries. The size of is controlled by the DI property Constants.SERVER_MAX_ID_QUALIFIER_SIZE_PROPERTY (the default number of conditions in the generated WHERE clause is 10000). Cayenne will generate (1 + N * M) SQL statements for each query using disjoint-by-ID prefetches, where N is the number of relationships to prefetch, and M is the number of queries for a given prefetch that is dependent on the number of objects in the result (ideally M = 1).
+
+The advantage of this type of prefetch is that matching database rows by ID may be much faster than matching the qualifier of the original query. Moreover this is *the only type of prefetch* that can handle SelectQueries with *fetch* limit. Both joint and regular disjoint prefetches may produce invalid results or generate inefficient fetch-the-entire table SQL when fetch limit is in effect.
+
+The disadvantage is that query SQL can get unwieldy for large result sets, as each object will have to have its own condition in the WHERE clause of the generated SQL.
+
+===== Joint Prefetching Semantics
+
+Joint semantics results in a single SQL statement for root objects and any number of jointly prefetched paths. Cayenne processes in memory a cartesian product of the entities involved, converting it to an object tree. It uses OUTER joins to connect prefetched entities.
+
+Joint is the most efficient prefetch type of the three as far as generated SQL goes. There's always just 1 SQL query generated. Its downsides are the potentially increased amount of data that needs to get across the network between the application server and the database, and more data processing that needs to be done on the Cayenne side.
+
+==== Data Rows
+
+Converting result set data to Persistent objects and registering these objects in the ObjectContext can be an expensive operation compareable to the time spent running the query (and frequently exceeding it). Internally Cayenne builds the result as a list of DataRows, that are later converted to objects. Skipping the last step and using data in the form of DataRows can significantly increase performance.
+
+DataRow is a simply a map of values keyed by their DB column name. It is a ubiqutous representation of DB data used internally by Cayenne. And it can be quite usable as is in the application in many cases. So performance sensitive selects should consider DataRows - it saves memory and CPU cycles. All selecting queries support DataRows option, e.g.:
+
+[source, Java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+query.setFetchingDataRows(true);
+
+List<DataRow> rows = context.performQuery(query);
+----
+
+[source, Java]
+----
+SQLTemplate query = new SQLTemplate(Artist.class, "SELECT * FROM ARTIST");
+query.setFetchingDataRows(true);
+
+List<DataRow> rows = context.performQuery(query);
+----
+
+Moreover DataRows may be converted to Persistent objects later as needed. So e.g. you may implement some in-memory filtering, only converting a subset of fetched objects:
+
+[source, Java]
+----
+// you need to cast ObjectContext to DataContext to get access to 'objectFromDataRow'
+DataContext dataContext = (DataContext) context;
+
+for(DataRow row : rows) {
+    if(row.get("DATE_OF_BIRTH") != null) {
+        Artist artist = dataContext.objectFromDataRow(Artist.class, row);
+        // do something with Artist...
+        ...
+    }
+}
+----
+
+==== Iterated Queries
+
+While contemporary hardware may easily allow applications to fetch hundreds of thousands or even millions of objects into memory, it doesn't mean this is always a good idea to do so. You can optimize processing of very large result sets with two techniques discussed in this and the following chapter - iterated and paginated queries.
+
+Iterated query is not actually a special query. Any selecting query can be executed in iterated mode by the DataContext (like in the previous example, a cast to DataContext is needed). DataContext returns an object called ResultIterator that is backed by an open ResultSet. Data is read from ResultIterator one row at a time until it is exhausted. Data comes as a DataRows regardless of whether the orginating query was configured to fetch DataRows or not. A ResultIterator must be explicitly closed to avoid JDBC resource leak.
+
+Iterated query provides constant memory performance for arbitrarily large ResultSets. This is true at least on the Cayenne end, as JDBC driver may still decide to bring the entire ResultSet into the JVM memory.
+
+Here is a full example:
+[source, Java]
+----
+// you need to cast ObjectContext to DataContext to get access to 'performIteratedQuery'
+DataContext dataContext = (DataContext) context;
+
+// create a regular query
+SelectQuery q = new SelectQuery(Artist.class);
+
+// ResultIterator operations all throw checked CayenneException
+// moreover 'finally' is required to close it
+try {
+
+    ResultIterator it = dataContext.performIteratedQuery(q);
+
+    try {
+        while(it.hasNextRow()) {
+            // normally we'd read a row, process its data, and throw it away
+            // this gives us constant memory performance
+            Map row = (Map) it.nextRow();
+
+            // do something with the row...
+            ...
+        }
+    }
+    finally {
+        it.close();
+    }
+}
+catch(CayenneException e) {
+   e.printStackTrace();
+}
+----
+
+Also common sense tells us that ResultIterators should be processed and closed as soon as possible to release the DB connection. E.g. storing open iterators between HTTP requests and for unpredictable length of time would quickly exhaust the connection pool.
+
+==== Paginated Queries
+
+Enabling query pagination allows to load very large result sets in a Java app with very little memory overhead (much smaller than even the DataRows option discussed above). Moreover it is completely transparent to the application - a user gets what appears to be a list of Persistent objects - there's no iterator to close or DataRows to convert to objects:
+
+[source, Java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+query.setPageSize(50);
+
+// the fact that result is paginated is transparent
+List<Artist> artists = ctxt.performQuery(query);
+----
+
+Having said that, DataRows option can be combined with pagination, providing the best of both worlds:
+
+
+[source, Java]
+----
+SelectQuery query = new SelectQuery(Artist.class);
+query.setPageSize(50);
+query.setFetchingDataRows(true);
+
+List<DataRow> rows = ctxt.performQuery(query);
+----
+
+The way pagination works internally, it first fetches a list of IDs for the root entity of the query. This is very fast and initially takes very little memory. Then when an object is requested at an arbitrary index in the list, this object and adjacent objects (a "page" of objects that is determined by the query pageSize parameter) are fetched together by ID. Subsequent requests to the objects of this "page" are served from memory.
+
+An obvious limitation of pagination is that if you eventually access all objects in the list, the memory use will end up being the same as with no pagination. However it is still a very useful approach. With some lists (e.g. multi-page search results) only a few top objects are normally accessed. At the same time pagination allows to estimate the full list size without fetching all the objects. And again - it is completely transparent and looks like a normal query.
+
+[[caching]]
+==== Caching and Fresh Data
+
+===== Object Caching
+
+===== Query Result Caching
+
+==== Turning off Synchronization of ObjectContexts
+
+By default when a single ObjectContext commits its changes, all other contexts in the same runtime receive an event that contains all the committed changes. This allows them to update their cached object state to match the latest committed data. There are however many problems with this ostensibly helpful feature. In short - it works well in environments with few contexts and in unclustered scenarios, such as single user desktop applications, or simple webapps with only a few users. More specifically:
+
+- The performance of synchronization is (probably worse than) O(N) where N is the number of peer ObjectContexts in the system. In a typical webapp N can be quite large. Besides for any given context, due to locking on synchronization, context own performance will depend not only on the queries that it runs, but also on external events that it does not control. This is unacceptable in most situations.
+
+- Commit events are untargeted - even contexts that do not hold a given updated object will receive the full event that they will have to process.
+
+- Clustering between JVMs doesn't scale - apps with large volumes of commits will quickly saturate the network with events, while most of those will be thrown away on the receiving end as mentioned above.
+
+- Some contexts may not want to be refreshed. A refresh in the middle of an operation may lead to unpredictable results.
+
+- Synchronization will interfere with optimistic locking.
+
+So we've made a good case for disabling synchronization in most webapps. To do that, set to "false" the following DI property - `_Constants.SERVER_CONTEXTS_SYNC_PROPERTY_`, using one of the standard Cayenne DI approaches. E.g. from command line:
+
+[source]
+----
+$ java -Dcayenne.server.contexts_sync_strategy=false
+----
+
+Or by changing the standard properties Map in a custom extensions module:
+
+[source, Java]
+----
+public class MyModule implements Module {
+
+    @Override
+    public void configure(Binder binder) {
+        binder.bindMap(Constants.PROPERTIES_MAP).put(Constants.SERVER_CONTEXTS_SYNC_PROPERTY, "false");
+    }
+}
+----
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3.adoc
new file mode 100644
index 0000000..5e211d1
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3.adoc
@@ -0,0 +1,28 @@
+// 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.
+
+== Cayenne Framework - Remote Object Persistence
+
+include::part3/rop.adoc[]
+
+include::part3/ropSetup.adoc[]
+
+include::part3/serverImpl.adoc[]
+
+include::part3/clientImpl.adoc[]
+
+include::part3/ropDeployment.adoc[]
+
+include::part3/limitations.adoc[]
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/clientImpl.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/clientImpl.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/clientImpl.adoc
new file mode 100644
index 0000000..027a22e
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/clientImpl.adoc
@@ -0,0 +1,16 @@
+// 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.
+
+=== Implementing ROP Client
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/limitations.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/limitations.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/limitations.adoc
new file mode 100644
index 0000000..f378cdb
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/limitations.adoc
@@ -0,0 +1,18 @@
+// 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.
+
+=== Current Limitations
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/rop.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/rop.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/rop.adoc
new file mode 100644
index 0000000..f69f98a
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/rop.adoc
@@ -0,0 +1,54 @@
+// 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.
+
+[[rop]]
+=== Introduction to ROP
+
+==== What is ROP
+
+"Remote Object Persistence" is a low-overhead web services-based technology that provides lightweight object persistence and query functionality to 'remote' applications. In other words it provides familiar Cayenne API to applications that do not have direct access to the database. Instead such applications would access Cayenne Web Service (CWS). A single abstract data model (expressed as Cayenne XML DataMap) is used on the server and on the client, while execution logic can be partitioned between the tiers.The following picture compares a regular Cayenne web application and a rich client application that uses remote object persistence technology:
+
+image::../images/remote-object-persistence.jpg[align="center"]
+
+Persistence stack above consists of the following parts:
+
+- ORM Tier: a server-side Cayenne Java application that directly connects to the database via JDBC.
+
+- CWS (Cayenne Web Service): A wrapper around an ORM tier that makes it accessible to remote CWS clients.
+
+- Remote Tier (aka Client Tier): A Java application that has no direct DB connection and persists its objects by connecting to remote Cayenne Web Service (CWS). Note that CWS Client doesn't have to be a desktop application. It can be another server-side application. The word "client" means a client of Cayenne Web Service.
+
+==== Main Features
+
+- Unified approach to lightweight object persistence across multiple tiers of a distributed system.
+
+- Same abstract object model on the server and on the client.
+
+- Client can "bootstrap" from the server by dynamically loading persistence metadata.
+
+- An ability to define client objects differently than the server ones, and still have seamless persistence.
+
+- Generic web service interface that doesn't change when object model changes.
+
+- An ability to work in two modes: dedicated session mode or shared ("chat") mode when multiple remote clients collaboratively work on the same data.
+
+- Lazy object and collection faulting.
+
+- Full context lifecycle
+
+- Queries, expressions, local query caching, paginated queries.
+
+- Validation
+
+- Delete Rules
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropDeployment.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropDeployment.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropDeployment.adoc
new file mode 100644
index 0000000..6aa4388
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropDeployment.adoc
@@ -0,0 +1,34 @@
+// 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.
+
+=== ROP Deployment
+
+==== Deploying ROP Server
+
+NOTE: Recent versions of Tomcat and Jetty containers (e.g. Tomcat 6 and 7, Jetty 8) contain code addressing a security concern related to "session fixation problem" by resetting the existing session ID of any request that requires BASIC authentcaition. If ROP service is protected with declarative security (see the ROP tutorial and the following chapters on security), this feature prevents the ROP client from attaching to its session, resulting in MissingSessionExceptions. To solve that you will need to either switch to an alternative security mechanism, or disable "session fixation problem" protections of the container. E.g. the later can be achieved in Tomcat 7 by adding the following context.xml file to the webapp's META-INF/ directory:
+
+[source, XML]
+----
+<Context>
+    <Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
+            changeSessionIdOnAuthentication="false" />
+</Context>
+----
+
+(The <Valve> tag can also be placed within the <Context> in any other locations used by Tomcat to load context configurations)
+
+==== Deploying ROP Client
+
+==== Security
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropSetup.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropSetup.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropSetup.adoc
new file mode 100644
index 0000000..0307dfb
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/ropSetup.adoc
@@ -0,0 +1,20 @@
+// 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.
+
+=== Implementing ROP Client
+
+==== System Requirements
+
+==== Jar Files and Dependencies
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/serverImpl.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/serverImpl.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/serverImpl.adoc
new file mode 100644
index 0000000..67e09e2
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part3/serverImpl.adoc
@@ -0,0 +1,16 @@
+// 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.
+
+=== Implementing ROP Server
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
new file mode 100644
index 0000000..d234723
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/serviceCollections.adoc
@@ -0,0 +1,62 @@
+// 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.
+
+== Appendix B. Service Collections
+
+Note that the collection keys below are defined as constants in `org.apache.cayenne.configuration.Constants` interface.
+
+[#serviceCollections.table.table-bordered]
+.Service Collection Keys Present in ServerRuntime and/or ClientRuntime
+[cols="3,2,3"]
+|===
+|Collection Property |Type |Description
+
+.^|`cayenne.properties`
+.^|`Map<String,String>`
+.^|Properties used by built-in Cayenne services. The keys in this map are the property names from the table in Appendix A. Separate copies of this map exist on the server and ROP client.
+
+.^|`cayenne.server.adapter_detectors`
+.^|`List<DbAdapterDetector>`
+.^|Contains objects that can discover the type of current database and install the correct DbAdapter in runtime.
+
+.^|`cayenne.server.domain_filters`
+.^|`List<DataChannelFilter>`
+.^|Stores DataDomain filters.
+
+
+.^|`cayenne.server.project_locations`
+.^|`List<String>`
+.^|Stores locations of the one of more project configuration files.
+
+
+.^|`cayenne.server.default_types`
+.^|`List<ExtendedType>`
+.^|Stores default adapter-agnostic ExtendedTypes. Default ExtendedTypes can be overridden / extended by DB-specific DbAdapters as well as by user-provided types configured in another colltecion (see `"cayenne.server.user_types"`).
+
+
+.^|`cayenne.server.user_types`
+.^|`List<ExtendedType>`
+.^|Stores a user-provided ExtendedTypes. This collection will be merged into a full list of ExtendedTypes and would override any ExtendedTypes defined in a default list, or by a DbAdapter.
+
+
+.^|`cayenne.server.type_factories`
+.^|`List<ExtendedTypeFactory>`
+.^|Stores default and user-provided ExtendedTypeFactories. ExtendedTypeFactory allows to define ExtendedTypes dynamically for the whole group of Java classes. E.g. Cayenne supplies a factory to map all Enums regardless of their type.
+
+
+.^|`cayenne.server.rop_event_bridge_properties`
+.^|`Map<String, String>`
+.^|Stores event bridge properties passed to the ROP client on bootstrap. This means that the map is configured by server DI, and passed to the client via the wire. The properties in this map are specific to EventBridgeFactory implementation (e.g JMS or XMPP connection prameters). One common property is `"cayenne.server.rop_event_bridge_factory"` that defines the type of the factory.
+
+|===
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/var.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/var.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/var.adoc
new file mode 100644
index 0000000..e575eda
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/var.adoc
@@ -0,0 +1 @@
+:version: {project-version}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/cayenne-guide.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/cayenne-guide.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/cayenne-guide.adoc
new file mode 100644
index 0000000..ab8c880
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/cayenne-guide.adoc
@@ -0,0 +1,47 @@
+// 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.
+= Cayenne Guide
+:revnumber: {project-major-version} ({project-version})
+// enable section numbering, limiting depth to 2
+:sectnums:
+:sectnumlevels: 2
+// use custom header
+:cayenne-header: _cayenne_guide/header.html
+:cayenne-header-position: body
+// customize final layout
+//:linkcss:
+// base path to java code include
+:cayenne-root: {basedir}/../../..
+
+[small]#Copyright © 2011-2017 Apache Software Foundation and individual authors#
+
+.License
+[small]#_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_#
+
+[small]#_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._#
+
+include::_cayenne-guide/part1.adoc[]
+include::_cayenne-guide/part2.adoc[]
+include::_cayenne-guide/part3.adoc[]
+include::_cayenne-guide/configurationProperties.adoc[]
+include::_cayenne-guide/serviceCollections.adoc[]
+include::_cayenne-guide/expressionsBNF.adoc[]
+include::_cayenne-guide/listOfTables.adoc[]
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/ext-crypto-obj-entity.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/ext-crypto-obj-entity.png b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/ext-crypto-obj-entity.png
new file mode 100644
index 0000000..2d8c32a
Binary files /dev/null and b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/ext-crypto-obj-entity.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-datasource-select.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-datasource-select.png b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-datasource-select.png
new file mode 100644
index 0000000..79ada1c
Binary files /dev/null and b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-datasource-select.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-reverseengineering-dialog.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-reverseengineering-dialog.png b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-reverseengineering-dialog.png
new file mode 100644
index 0000000..8b09d07
Binary files /dev/null and b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/re-modeler-reverseengineering-dialog.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/remote-object-persistence.jpg
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/remote-object-persistence.jpg b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/remote-object-persistence.jpg
new file mode 100644
index 0000000..43f820d
Binary files /dev/null and b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/images/remote-object-persistence.jpg differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/pom.xml b/docs/asciidoc/getting-started-guide/pom.xml
new file mode 100644
index 0000000..041f2bd
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/pom.xml
@@ -0,0 +1,170 @@
+<?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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.parents</groupId>
+        <artifactId>cayenne-asciidoc-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>getting-started-guide</artifactId>
+
+    <packaging>jar</packaging>
+    <name>getting-started-guide: AsciiDoc - Getting Started with Cayenne</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.asciidoctor</groupId>
+                <artifactId>asciidoctor-maven-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cayenne.docs</groupId>
+                        <artifactId>cayenne-asciidoc-extension</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <!-- generate "embeddable" html content with front matter and without header/footer/styles -->
+                    <execution>
+                        <id>asciidoctor-html-web</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>process-asciidoc</goal>
+                        </goals>
+                        <configuration>
+                            <backend>html5</backend>
+                            <headerFooter>false</headerFooter> <!-- do not generate header and footer -->
+                            <outputDirectory>${project.build.directory}/tmp/</outputDirectory>
+                            <extensions>
+                                <extension>
+                                    <className>org.apache.cayenne.asciidoc.CayennePostProcessor</className>
+                                </extension>
+                            </extensions>
+                            <attributes>
+                                <toc>auto</toc>
+                            </attributes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Move images to proper path for site -->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy docs for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/</directory>
+                                    <includes>
+                                        <include>${project.artifactId}.html</include>
+                                        <include>${project.artifactId}.toc.html</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy images for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/${project.artifactId}/images/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/images/</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>assembly</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.asciidoctor</groupId>
+                        <artifactId>asciidoctor-maven-plugin</artifactId>
+                        <executions>
+                            <!-- generate standalone html help -->
+                            <execution>
+                                <id>asciidoctor-html-standalone</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>html5</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <embedAssets>true</embedAssets>
+                                    <attributes>
+                                        <toc>left</toc>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+
+                            <!-- generate PDF -->
+                            <execution>
+                                <id>generate-pdf-doc</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>pdf</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <attributes>
+                                        <pagenums/>
+                                        <toc/>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file


[03/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/html.xsl
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/html.xsl b/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/html.xsl
deleted file mode 100644
index 11b6d4f..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/html.xsl
+++ /dev/null
@@ -1,244 +0,0 @@
-<?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"
-                version="1.0" xmlns:d="http://docbook.org/ns/docbook">
-
-
-    <xsl:import href="urn:docbkx:stylesheet"/>
-    <xsl:import href="highlight.xsl"/>
-    <xsl:include href="common-customizations.xsl"/>
-
-    <!--<xsl:param name="highlight.source" select="1"/>-->
-    <xsl:param name="html.stylesheet" select="'css/cayenne-doc.css'"/>
-    <xsl:param name="chunker.output.encoding">UTF-8</xsl:param>
-
-    <!-- Only chapters start a new page -->
-    <xsl:param name="chunk.section.depth">0</xsl:param>
-
-    <!-- Don't add any embedded styles -->
-    <xsl:param name="css.decoration">0</xsl:param>
-
-    <xsl:param name="ignore.image.scaling">1</xsl:param>
-
-    <xsl:param name="use.id.as.filename">1</xsl:param>
-
-    <xsl:param name="navig.showtitles">1</xsl:param>
-
-    <!--
-        BODY > HEAD Customization
-        Customized template for generate meta tags with cayenne version in head of
-        page with documentation
-    -->
-    <xsl:template name="head.content">
-        <xsl:param name="node" select="."/>
-        <xsl:param name="title">
-            <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
-        </xsl:param>
-
-        <title>
-            <xsl:copy-of select="$title"/>
-        </title>
-
-        <xsl:if test="$html.base != ''">
-            <base href="{$html.base}"/>
-        </xsl:if>
-
-        <!-- Insert links to CSS files or insert literal style elements -->
-        <xsl:call-template name="generate.css"/>
-
-        <xsl:if test="$html.stylesheet != ''">
-            <xsl:call-template name="output.html.stylesheets">
-                <xsl:with-param name="stylesheets" select="normalize-space($html.stylesheet)"/>
-            </xsl:call-template>
-        </xsl:if>
-
-        <xsl:if test="$link.mailto.url != ''">
-            <link rev="made" href="{$link.mailto.url}"/>
-        </xsl:if>
-
-        <meta name="keywords" content="Cayenne ${cayenne.version.major} documentation"/>
-        <meta name="description" content="User documentation for Apache Cayenne version ${cayenne.version.major}"/>
-
-        <xsl:if test="$generate.meta.abstract != 0">
-            <xsl:variable name="info" select="(d:articleinfo
-                                      |d:bookinfo
-                                      |d:prefaceinfo
-                                      |d:chapterinfo
-                                      |d:appendixinfo
-                                      |d:sectioninfo
-                                      |d:sect1info
-                                      |d:sect2info
-                                      |d:sect3info
-                                      |d:sect4info
-                                      |d:sect5info
-                                      |d:referenceinfo
-                                      |d:refentryinfo
-                                      |d:partinfo
-                                      |d:info
-                                      |d:docinfo)[1]"/>
-            <xsl:if test="$info and $info/d:abstract">
-                <meta name="description">
-                    <xsl:attribute name="content">
-                        <xsl:for-each select="$info/d:abstract[1]/*">
-                            <xsl:value-of select="normalize-space(.)"/>
-                            <xsl:if test="position() &lt; last()">
-                                <xsl:text> </xsl:text>
-                            </xsl:if>
-                        </xsl:for-each>
-                    </xsl:attribute>
-                </meta>
-            </xsl:if>
-        </xsl:if>
-
-        <xsl:if test="($draft.mode = 'yes' or
-                ($draft.mode = 'maybe' and
-                ancestor-or-self::*[@status][1]/@status = 'draft'))
-                and $draft.watermark.image != ''">
-            <style type="text/css"><xsl:text>
-body { background-image: url('</xsl:text>
-                <xsl:value-of select="$draft.watermark.image"/><xsl:text>');
-       background-repeat: no-repeat;
-       background-position: top left;
-       /* The following properties make the watermark "fixed" on the page. */
-       /* I think that's just a bit too distracting for the reader... */
-       /* background-attachment: fixed; */
-       /* background-position: center center; */
-     }</xsl:text>
-            </style>
-        </xsl:if>
-        <xsl:apply-templates select="." mode="head.keywords.content"/>
-    </xsl:template>
-
-    <!-- GoogleAnalytics script for web publishing -->
-    <xsl:template name="user.head.content">
-        <script type="text/javascript">
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-7036673-1']);
-  _gaq.push(['_trackPageview']);
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-        </script>
-    </xsl:template>
-
-    <!--
-        TOP NAVIGATION
-    -->
-    <xsl:template name="header.navigation">
-        <xsl:param name="prev" select="/d:foo"/>
-        <xsl:param name="next" select="/d:foo"/>
-        <xsl:param name="nav.context"/>
-
-        <xsl:variable name="home" select="/*[1]"/>
-        <xsl:variable name="up" select="parent::*"/>
-
-        <xsl:variable name="row1" select="$navig.showtitles != 0"/>
-        <xsl:variable name="row2" select="count($prev) &gt; 0
-                                    or (count($up) &gt; 0
-                                        and generate-id($up) != generate-id($home)
-                                        and $navig.showtitles != 0)
-                                    or count($next) &gt; 0"/>
-
-        <xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
-            <div class="navheader">
-                <xsl:if test="$row1 or $row2">
-                    <table width="100%" summary="Navigation header">
-                      
-                        <!-- Add Apache Cayenne version info -->
-                        <xsl:if test="$row1">
-                            <tr>
-                                <th class="versioninfo">v.${cayenne.version.major} (${pom.version})</th>
-                                <th align="center">
-                                    <xsl:apply-templates select="." mode="object.title.markup"/>
-                                </th>
-                                <th></th>
-                            </tr>
-                        </xsl:if>
-
-                        <xsl:if test="$row2">
-
-                            <tr>
-                                <td width="20%" align="{$direction.align.start}">
-                                    <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>&#160;</xsl:text>
-                                </td>
-
-                                <!-- Make parent caption as link -->
-                                <th width="60%" align="center">
-                                    <xsl:choose>
-                                        <xsl:when test="count($up) > 0
-                                  and generate-id($up) != generate-id($home)
-                                  and $navig.showtitles != 0">
-                                            <a accesskey="u">
-                                                <xsl:attribute name="href">
-                                                    <xsl:call-template name="href.target">
-                                                        <xsl:with-param name="object" select="$up"/>
-                                                    </xsl:call-template>
-                                                </xsl:attribute>
-                                                <xsl:apply-templates select="$up" mode="object.title.markup"/>
-                                            </a>
-                                        </xsl:when>
-                                        <xsl:otherwise>&#160;</xsl:otherwise>
-                                    </xsl:choose>
-                                </th>
-
-
-                                <td width="20%" align="{$direction.align.end}">
-                                    <xsl:text>&#160;</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>
-
-                    </table>
-                </xsl:if>
-                <xsl:if test="$header.rule != 0">
-                    <hr/>
-                </xsl:if>
-            </div>
-        </xsl:if>
-    </xsl:template>
-
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/pdf.xsl
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/pdf.xsl b/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/pdf.xsl
deleted file mode 100644
index f716411..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/pdf.xsl
+++ /dev/null
@@ -1,505 +0,0 @@
-<?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.
--->
-<!--
-    This is the XSL FO (PDF) stylesheet for the Cayenne 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:include href="common-customizations.xsl"/>
-
-    <xsl:template name="border">
-        <xsl:param name="side" select="'start'"/>
-
-        <xsl:attribute name="border-{$side}-width">
-            <xsl:value-of select="$table.cell.border.thickness"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-{$side}-style">
-            <xsl:value-of select="$table.cell.border.style"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-{$side}-color">
-            <xsl:value-of select="$table.cell.border.color"/>
-        </xsl:attribute>
-        <xsl:attribute name="my-attr">
-            <xsl:value-of select="'1'"/>
-        </xsl:attribute>
-    </xsl:template>
-
-    <!-- don't indent the body text -->
-    <xsl:param name="body.start.indent">0pt</xsl:param>
-
-    <!-- print headers and footers mirrored so double sided printing works -->
-    <!--<xsl:param name="fop1.extensions" select="1"/>-->
-    <xsl:param name="double.sided" select="0"/>
-
-    <xsl:param name="admon.graphics" select="0"/>
-    <xsl:param name="admon.graphics.extension">.png</xsl:param>
-    <xsl:param name="admon.graphics.path">stylesheets/docbook-xsl-ns/images/</xsl:param>
-    <xsl:param name="admon.textlabel" select="1"/>
-
-    <xsl:param name="callout.graphics" select="1"/>
-    <xsl:param name="callout.graphics.extension">.png</xsl:param>
-    <xsl:param name="callout.graphics.path">stylesheets/docbook-xsl-ns/images/callouts/</xsl:param>
-
-    <xsl:param name="footer.rule">0</xsl:param>
-
-    <!-- Separation between glossary terms and descriptions when glossaries are presented using lists. -->
-    <xsl:param name="glossterm.separation">2em</xsl:param>
-
-    <!-- This parameter specifies the width reserved for glossary terms when a list presentation is used.  -->
-    <xsl:param name="glossterm.width">10em</xsl:param>
-
-    <!--  Specifies the longest term in variablelists. In variablelists, the listitem is indented to leave room for the term elements. The indent may be computed if it is not specified with a termlength attribute on the variablelist element. The computation counts characters in the term elements in the list to find the longest term. However, some terms are very long and would produce extreme indents. This parameter lets you set a maximum character count. Any terms longer than the maximum would line wrap. The default value is 24. The character counts are converted to physical widths by multiplying by 0.50em. There is some variability in how many characters fit in the space since some characters are wider than others. -->
-    <xsl:param name="variablelist.max.termlength">18</xsl:param>
-
-    <!-- Custom font settings - preferred truetype font -->
-    <xsl:param name="title.font.family">Lucinda Grande,sans-serif</xsl:param>
-    <xsl:param name="body.font.family">Times,serif</xsl:param>
-    <xsl:param name="sans.font.family">Lucinda Grande,sans-serif</xsl:param>
-    <xsl:param name="dingbat.font.family">Lucinda Grande,serif</xsl:param>
-    <xsl:param name="monospace.font.family">monospace</xsl:param>
-
-    <!-- Specify the default text alignment. The default text alignment is used for most body text. -->
-    <xsl:param name="alignment">justify</xsl:param>
-
-    <!--  Specifies the default point size for body text. The body font size is specified in two parameters (body.font.master and body.font.size) so that math can be performed on the font size by XSLT. -->
-    <xsl:param name="body.font.master">11</xsl:param>
-
-    <xsl:param name="hyphenate">true</xsl:param>
-
-    <!-- "normal" is 1.6. This value is multiplied by the font size -->
-    <xsl:param name="line-height">1.5</xsl:param>
-
-    <!--  Specify the spacing required between normal paragraphs. -->
-    <xsl:attribute-set name="normal.para.spacing">
-        <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
-        <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
-        <xsl:attribute name="space-before.maximum">1.0em</xsl:attribute>
-    </xsl:attribute-set>
-
-    <!--  Tables, examples, figures, and equations don't need to be forced onto onto one page without page breaks. -->
-    <xsl:attribute-set name="formal.object.properties">
-        <xsl:attribute name="keep-together.within-column">auto</xsl:attribute>
-    </xsl:attribute-set>
-
-    <!-- The body bottom margin is the distance from the last line of text in the page body to the bottom of the region-after. -->
-    <xsl:param name="body.margin.bottom">20mm</xsl:param>
-
-    <!-- The body top margin is the distance from the top of the region-before to the first line of text in the page body. -->
-    <xsl:param name="body.margin.top">20mm</xsl:param>
-
-    <!-- The top page margin is the distance from the physical top of the page to the top of the region-before. -->
-    <xsl:param name="page.margin.top">10mm</xsl:param>
-
-    <!-- The bottom page margin is the distance from the bottom of the region-after to the physical bottom of the page. -->
-    <xsl:param name="page.margin.bottom">10mm</xsl:param>
-
-    <!-- The inner page margin. The inner page margin is the distance from binding edge of the page to the first column of text. In the left-to-right, top-to-bottom writing direction, this is the left margin of recto pages. The inner and outer margins are usually the same unless the output is double-sided. -->
-    <xsl:param name="page.margin.inner">18mm</xsl:param>
-
-    <!-- The outer page margin. The outer page margin is the distance from non-binding edge of the page to the last column of text. In the left-to-right, top-to-bottom writing direction, this is the right margin of recto pages. The inner and outer margins are usually the same unless the output is double-sided. -->
-    <xsl:param name="page.margin.outer">18mm</xsl:param>
-
-    <!-- Make hyperlinks blue and don't display the underlying URL -->
-    <xsl:param name="ulink.show" select="0"/>
-
-    <xsl:attribute-set name="xref.properties">
-        <xsl:attribute name="color">blue</xsl:attribute>
-    </xsl:attribute-set>
-
-    <xsl:param name="img.src.path">../</xsl:param>
-
-    <!-- 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">
-            <fo:inline min-width="150mm">v.${cayenne.version.major}</fo:inline>
-        </xsl:variable>
-        <xsl:choose>
-            <xsl:when test="$sequence='blank'">
-                <xsl:if test="$position = 'left'">
-                    <xsl:value-of select="$Version"/>
-                </xsl:if>
-            </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='left'">
-                        <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="use.extensions">1</xsl:param>
-    <xsl:param name="tablecolumns.extension">1</xsl:param>
-    <xsl:param name="callout.extensions">1</xsl:param>
-    <!-- FOP provide only PDF Bookmarks at the moment -->
-    <xsl:param name="fop1.extensions">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">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>
-
-    <!-- ###################################################
-                  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-start">4pt</xsl:attribute>
-        <xsl:attribute name="padding-end">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="default.table.frame">all</xsl:param>
-    <xsl:param name="default.table.rules">all</xsl:param>
-
-    <xsl:param name="table.frame.border.thickness">0.5pt</xsl:param>
-    <xsl:param name="table.frame.border.style">solid</xsl:param>
-    <xsl:param name="table.frame.border.color">black</xsl:param>
-    <xsl:param name="table.cell.border.thickness">0.5pt</xsl:param>
-    <xsl:param name="table.cell.border.color">black</xsl:param>
-    <xsl:param name="table.cell.border.style">solid</xsl:param>
-    <xsl:param name="border-start-style">solid</xsl:param>
-    <xsl:param name="border-end-style">solid</xsl:param>
-    <xsl:param name="border-top-style">solid</xsl:param>
-    <xsl:param name="border-bottom-style">solid</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 (<code>) -->
-    <xsl:attribute-set name="monospace.properties">
-        <xsl:attribute name="font-size">
-            <xsl:value-of select="$body.font.small"/>
-            <xsl:text>pt</xsl:text>
-        </xsl:attribute>
-    </xsl:attribute-set>
-
-    <!-- Verbatim text formatting (programlistings) -->
-    <xsl:attribute-set name="monospace.verbatim.properties">
-        <xsl:attribute name="font-size">
-            <xsl:value-of select="$body.font.small"/>
-            <xsl:text>pt</xsl:text>
-        </xsl:attribute>
-    </xsl:attribute-set>
-
-    <xsl:attribute-set name="verbatim.properties">
-        <xsl:attribute name="space-before.minimum">0.9em</xsl:attribute>
-        <xsl:attribute name="space-before.optimum">0.9em</xsl:attribute>
-        <xsl:attribute name="space-before.maximum">0.9em</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">&admon_gfx_path;</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 name="table.frame">
-        <xsl:variable name="frame" select="'all'" />
-
-        <xsl:attribute name="border-start-style">
-            <xsl:value-of select="$table.frame.border.style"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-end-style">
-            <xsl:value-of select="$table.frame.border.style"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-top-style">
-            <xsl:value-of select="$table.frame.border.style"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-bottom-style">
-            <xsl:value-of select="$table.frame.border.style"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-start-width">
-            <xsl:value-of select="$table.frame.border.thickness"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-end-width">
-            <xsl:value-of select="$table.frame.border.thickness"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-top-width">
-            <xsl:value-of select="$table.frame.border.thickness"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-bottom-width">
-            <xsl:value-of select="$table.frame.border.thickness"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-start-color">
-            <xsl:value-of select="$table.frame.border.color"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-end-color">
-            <xsl:value-of select="$table.frame.border.color"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-top-color">
-            <xsl:value-of select="$table.frame.border.color"/>
-        </xsl:attribute>
-        <xsl:attribute name="border-bottom-color">
-            <xsl:value-of select="$table.frame.border.color"/>
-        </xsl:attribute>
-    </xsl:template>
-
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/pom.xml b/docs/docbook/getting-started-rop/pom.xml
deleted file mode 100644
index 7331170..0000000
--- a/docs/docbook/getting-started-rop/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.   
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.apache.cayenne.docs</groupId>
-		<artifactId>cayenne-docbook</artifactId>
-		<version>3.1.3-SNAPSHOT</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.cayenne.docs</groupId>
-	<artifactId>getting-started-rop</artifactId>
-	<packaging>jar</packaging>
-	<name>Docbook: Getting Started with Cayenne ROP</name>
-
-	<build>
-		<resources>
-			<resource>
-				<directory>target/site</directory>
-			</resource>
-		</resources>
-	</build>
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/authentification.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/authentification.xml b/docs/docbook/getting-started-rop/src/docbkx/authentification.xml
deleted file mode 100644
index 04e251f..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/authentification.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Adding BASIC Authentication</title>
-    <para>You probably don't want everybody in the world to connect to your service and access (and
-        update!) arbitrary data in the database. The first step in securing Cayenne service is
-        implementing client authentication. The easiest way to do it is to delegate the
-        authentication task to the web container that is running the service. HessianConnection used
-        in the previous chapter supports BASIC authentication on the client side, so we'll
-        demonstrate how to set it up here.</para>
-    <section xml:id="securing-rop-server-app">
-        <title>Securing ROP Server Application</title>
-        <para>Open web.xml file in the server project and setup security constraints with BASIC
-            authentication for the ROP service:</para>
-        <programlisting>&lt;security-constraint&gt;
-    &lt;web-resource-collection&gt;
-        &lt;web-resource-name&gt;CayenneService&lt;/web-resource-name&gt;
-        &lt;url-pattern&gt;/cayenne-service&lt;/url-pattern&gt;
-    &lt;/web-resource-collection&gt;
-    &lt;auth-constraint&gt;
-        &lt;role-name&gt;cayenne-service-user&lt;/role-name&gt;
-    &lt;/auth-constraint&gt;
-&lt;/security-constraint&gt;
-    
-&lt;login-config&gt;
-    &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
-    &lt;realm-name&gt;Cayenne Realm&lt;/realm-name&gt;
-&lt;/login-config&gt;
-
-&lt;security-role&gt;
-    &lt;role-name&gt;cayenne-service-user&lt;/role-name&gt;
-&lt;/security-role&gt;</programlisting>
-    </section>
-    <section xml:id="configuring-jetty">
-        <title>Configuring Jetty for BASIC Authentication</title>
-        
-        <para>
-            <note>
-                <para>These instructions are specific to Jetty 6. Other
-                    containers (and versions of Jetty) will have different mechansims to achieve
-                    the same thing.</para>
-            </note>
-        </para>
-        <para>Open pom.xml in the server project and configure a "userRealm" for the Jetty
-            plugin:</para>
-        <programlisting>&lt;plugin&gt;
-    &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
-        &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt;
-        &lt;version&gt;6.1.22&lt;/version&gt;
-        &lt;!-- adding configuration below: --&gt;
-        &lt;configuration&gt;
-            &lt;userRealms&gt;
-                &lt;userRealm implementation="org.mortbay.jetty.security.HashUserRealm"&gt;
-                    &lt;!-- this name must match the realm-name in web.xml --&gt;
-                    &lt;name&gt;Cayenne Realm&lt;/name&gt;
-                    &lt;config&gt;realm.properties&lt;/config&gt;
-                &lt;/userRealm&gt;
-            &lt;/userRealms&gt;
-        &lt;/configuration&gt;
-    &lt;/plugin&gt;
-&lt;/plugins&gt;</programlisting>
-        <para>Now create a new file called {["realm.properties"}} <emphasis role="italic">at the
-                root of the server project</emphasis> and put user login/password in there:</para>
-        <programlisting>cayenne-user: secret,cayenne-service-user</programlisting>
-        <para>.</para>
-        <para>Now let's stop the server and start it again. Everything should start as before, but
-            if you go to <emphasis role="italic"
-                >http://localhost:8080/tutorial/cayenne-service</emphasis>, your browser should pop
-            up authentication dialog. Enter "<emphasis role="italic">cayenne-user/secret</emphasis>"
-            for user name / password, and you should see "<emphasis role="italic">Hessian Requires
-                POST</emphasis>" message. So the server is now secured.</para>
-    </section>
-    <section xml:id="running-client">
-        <title>Running Client with Basic Authentication</title>
-        <para>If you run the client without any changes, you'll get the following error:</para>
-        <programlisting language="java">org.apache.cayenne.remote.hessian.HessianConnection connect
-INFO: Connecting to [http://localhost:8080/tutorial/cayenne-service] - dedicated session.
-org.apache.cayenne.remote.hessian.HessianConnection connect
-INFO: Error establishing remote session. URL - http://localhost:8080/tutorial/cayenne-service; 
-      CAUSE - cannot retry due to server authentication, in streaming mode
-java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
-    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1257)
-    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
-    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:168)
-    at $Proxy0.establishSession(Unknown Source)
-    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:210)
-    at org.apache.cayenne.remote.hessian.HessianConnection.getServerEventBridge(HessianConnection.java:114)
-    at org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:337)
-    at org.apache.cayenne.remote.ClientChannel.&lt;init>(ClientChannel.java:108)
-    at org.example.cayenne.Main.main(Main.java:25)
-Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.3.1M3 Sep 19 2011 07:12:41] 
-Error establishing remote session. URL - http://localhost:8080/tutorial/cayenne-service; 
-CAUSE - cannot retry due to server authentication, in streaming mode
-    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:229)
-    at org.apache.cayenne.remote.hessian.HessianConnection.getServerEventBridge(HessianConnection.java:114)
-    at org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:337)
-    at org.apache.cayenne.remote.ClientChannel.&lt;init>(ClientChannel.java:108)
-    at org.example.cayenne.Main.main(Main.java:25)
-Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
-    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1257)
-    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
-    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:168)
-    at $Proxy0.establishSession(Unknown Source)
-    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:210)
-    ... 4 more</programlisting>
-        <para>Which is exactly what you'd expect, as the client is not authenticating itself. So
-            change the line in Main.java where we obtained an ROP connection to this:</para>
-        <programlisting language="java">ClientConnection connection = new HessianConnection(
-        "http://localhost:8080/tutorial/cayenne-service",
-        "cayenne-user", "secret", null);</programlisting>
-        <para>Try running again, and everything should work as before. Obviously in production
-            environment, in addition to authentication you'll need to use HTTPS to access the server
-            to prevent third-party evesdropping on your password and data.</para>
-        <para>Congratulations, you are done with the ROP tutorial!</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/client-code.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/client-code.xml b/docs/docbook/getting-started-rop/src/docbkx/client-code.xml
deleted file mode 100644
index ee8a3b6..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/client-code.xml
+++ /dev/null
@@ -1,161 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Porting Existing Code to Connect to a Web Service Instead of a Database</title>
-    <section xml:id="starting-command-line-cliet">
-        <title>Starting Command Line Client</title>
-        <para>One of the benefits of ROP is that the client code is no different from the server
-            code - it uses the same ObjectContext interface for access, same query and commit API.
-            So the code below will be similar to the code presented in the first Cayenne
-                Getting Started Guide, although with a few ROP-specific parts required to bootstrap the
-            ObjectContext.</para>
-        <para>Let's start by creating an empty Main class with the standard main() method in the
-            client project:</para>
-        <programlisting language="java">package org.example.cayenne.persistent.client;
-
-public class Main {
-
-    public static void main(String[] args) {
-
-    }
-}</programlisting>
-        <para>Now the part that is actually different from regular Cayenne - establishing the server
-            connection and obtaining the ObjectContext:</para>
-        <programlisting language="java">ClientConnection connection = new HessianConnection("http://localhost:8080/tutorial/cayenne-service");
-DataChannel channel = new ClientChannel(connection, false, new DefaultEventManager(), false);
-ObjectContext context = new CayenneContext(channel);</programlisting>
-        <para>Note that the "channel" can be used to create as many peer ObjectContexts as needed
-            over the same connection, while ObjectContext is a kind of isolated "persistence
-            session", similar to the server-side context. A few more notes. Since we are using
-            HTTP(S) to communicate with ROP server, there's no need to explicitly close the
-            connection (or channel, or context).</para>
-        <para>So now let's do the same persistent operaions that we did in the first tutorial "Main"
-            class. Let's start by creating and saving some objects:</para>
-        <programlisting language="java">// creating new Artist
-Artist picasso = context.newObject(Artist.class);
-picasso.setName("Pablo Picasso");
-
-// Creating other objects
-Gallery metropolitan = context.newObject(Gallery.class);
-metropolitan.setName("Metropolitan Museum of Art");
-
-Painting girl = context.newObject(Painting.class);
-girl.setName("Girl Reading at a Table");
-
-Painting stein = context.newObject(Painting.class);
-stein.setName("Gertrude Stein");
-
-// connecting objects together via relationships
-picasso.addToPaintings(girl);
-picasso.addToPaintings(stein);
-
-girl.setGallery(metropolitan);
-stein.setGallery(metropolitan);
-
-// saving all the changes above
-context.commitChanges();</programlisting>
-        <para>Now let's select them back:</para>
-        <programlisting language="java">// SelectQuery examples
-SelectQuery select1 = new SelectQuery(Painting.class);
-List&lt;Painting&gt; paintings1 = context.performQuery(select1);
-
-Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
-        Painting.NAME_PROPERTY, "gi%");
-SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
-List&lt;Painting&gt; paintings2 = context.performQuery(select2);</programlisting>
-        <para>Now, delete:</para>
-        <programlisting language="java">Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY,
-                "Pablo Picasso");
-SelectQuery selectToDelete = new SelectQuery(Artist.class, qualifier);
-Artist picasso = (Artist) DataObjectUtils.objectForQuery(context,
-        selectToDelete);
-
-if (picasso != null) {
-    context.deleteObject(picasso);
-    context.commitChanges();
-}</programlisting>
-        <para>This code is exactly the same as in the first tutorial. So now let's try running the
-            client and see what happens. In Eclipse open main class and select "Run &gt; Run As &gt;
-            Java Application" from the menu (assuming the ROP server started in the previous step is
-            still running). You will some output in both server and client process consoles.
-            Client:</para>
-        <programlisting>INFO: Connecting to [http://localhost:8080/tutorial/cayenne-service] - dedicated session.
-INFO: === Connected, session: org.apache.cayenne.remote.RemoteSession@26544ec1[sessionId=17uub1h34r9x1] - took 111 ms.
-INFO: --- Message 0: Bootstrap
-INFO: === Message 0: Bootstrap done - took 58 ms.
-INFO: --- Message 1: flush-cascade-sync
-INFO: === Message 1: flush-cascade-sync done - took 1119 ms.
-INFO: --- Message 2: Query
-INFO: === Message 2: Query done - took 48 ms.
-INFO: --- Message 3: Query
-INFO: === Message 3: Query done - took 63 ms.
-INFO: --- Message 4: Query
-INFO: === Message 4: Query done - took 19 ms.
-INFO: --- Message 5: Query
-INFO: === Message 5: Query done - took 7 ms.
-INFO: --- Message 6: Query
-INFO: === Message 6: Query done - took 5 ms.
-INFO: --- Message 7: Query
-INFO: === Message 7: Query done - took 2 ms.
-INFO: --- Message 8: Query
-INFO: === Message 8: Query done - took 4 ms.
-INFO: --- Message 9: flush-cascade-sync
-INFO: === Message 9: flush-cascade-sync done - took 34 ms.</programlisting>
-        <para>As you see client prints no SQL statmenets, just a bunch of query and flush messages
-            sent to the server. The server side is more verbose, showing the actual client queries
-            executed against the database:</para>
-        <programlisting>...
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
-INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
-INFO: [batch bind: 1->DATE_OF_BIRTH:NULL, 2->ID:200, 3->NAME:'Pablo Picasso']
-INFO: === updated 1 row.
-INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
-INFO: [batch bind: 1->ID:200, 2->NAME:'Metropolitan Museum of Art']
-INFO: === updated 1 row.
-INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
-INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200, 4->NAME:'Girl Reading at a Table']
-INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201, 4->NAME:'Gertrude Stein']
-INFO: === updated 2 rows.
-INFO: +++ transaction committed.
-INFO: --- transaction started.
-INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0
-INFO: === returned 2 rows. - took 14 ms.
-INFO: +++ transaction committed.
-INFO: --- transaction started.
-INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 
-      WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 1->NAME:'gi%']
-INFO: === returned 1 row. - took 10 ms.
-INFO: +++ transaction committed.
-INFO: --- transaction started.
-INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME = ? [bind: 1->NAME:'Pablo Picasso']
-INFO: === returned 1 row. - took 8 ms.
-INFO: +++ transaction committed.
-INFO: --- transaction started.
-INFO: DELETE FROM PAINTING WHERE ID = ?
-INFO: [batch bind: 1->ID:200]
-INFO: [batch bind: 1->ID:201]
-INFO: === updated 2 rows.
-INFO: DELETE FROM ARTIST WHERE ID = ?
-INFO: [batch bind: 1->ID:200]
-INFO: === updated 1 row.
-INFO: +++ transaction committed.</programlisting>
-        <para>You are done with the basic ROP client!</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/client-project.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/client-project.xml b/docs/docbook/getting-started-rop/src/docbkx/client-project.xml
deleted file mode 100644
index c5ead4b..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/client-project.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Starting Client Project</title>
-    <section xml:id="create-rop-client-project">
-        <title>Create an ROP Client Project in Eclipse</title>
-        <para>Creation of a new Eclipse project has been discussed in some details in "Getting
-            Started with Cayenne" guide, so we will omit the screenshots for the common
-            parts.</para>
-        <para>In Eclipse select "File &gt; New &gt; Other..." and then "Maven &gt; Maven Project".
-            Click "Next". On the following screen check "Create a simple project" checkbox and click
-            "Next" again. In the dialog shown on the screenshot below, enter "org.example.cayenne"
-            for the "Group Id" and "tutorial-rop-client" for the "Artifact Id" (both without the
-            quotes) and click "Finish". </para>
-        <para>Now you should have a new empty project in the Eclipse workspace. Check that the
-            project Java compiler settings are correct. Rightclick on the "tutorial-rop-client"
-            project, select "Properties &gt; Java Compiler" and ensure that "Compiler compliance
-            level" is at least 1.5 (some versions of Maven plugin seem to be setting it to 1.4 by
-            default).</para>
-    </section>
-    <section xml:id="create-client-java-classes">
-        <title>Create Client Java Classes</title>
-        <para>The client doesn't need the XML ORM mapping, as it is loaded from the server. However
-            it needs the client-side Java classes. Let's generate them from the existing
-            mapping:</para>
-        <itemizedlist>
-            <listitem>
-                <para>Start CayenneModeler and open cayenne.xml from the "tutorial" project (located
-                    under "tutorial/src/main/resources", unless it is already open.</para>
-            </listitem>
-            <listitem>
-                <para>Select the "datamap" DataMap and check "Allow Client Entities"
-                    checkbox.</para>
-            </listitem>
-            <listitem>
-                <para>Enter "org.example.cayenne.persistent.client" for the "Client Java Package"
-                    and click "Update.." button next to the field to refresh the client package of
-                    all entities.</para>
-                <para><inlinemediaobject>
-                        <imageobject>
-                            <imagedata fileref="images/datamap-enableclient.png" scalefit="1" width="100%"/>
-                        </imageobject>
-                    </inlinemediaobject></para>
-            </listitem>
-        </itemizedlist>
-        <itemizedlist>
-            <listitem>
-                <para>Select "Tools &gt; Generate Classes" menu.</para>
-            </listitem>
-            <listitem>
-                <para>For "Type" select "Client Persistent Objects".</para>
-            </listitem>
-            <listitem>
-                <para>For the "Output Directory" select "tutorial-rop-client/src/main/java" folder
-                    (as client classes should go in the <emphasis role="italic">client</emphasis>
-                    project).</para>
-            </listitem>
-            <listitem>
-                <para>Click on "Entities" tab and check the "Check All Classes" checkbox (unless it
-                    is already checked and reads "Uncheck all Classes").</para>
-            </listitem>
-            <listitem>
-                <para>Click "Generate".</para>
-            </listitem>
-        </itemizedlist>
-        <para>Now go back to Eclipse, right click on "tutorial-rop-client" project and select
-            "Refresh" - you should see pairs of classes generated for each mapped entity, same as on
-            the server. And again, we see a bunch of errors in those classes. Let's fix it now by
-            adding two dependencies, "cayenne-client" and "resin-hessian", in the bottom of the
-            pom.xml file. We also need to add Caucho M2 repository to pull Hessian jar files. The
-            resulting POM should look like this:</para>
-        <programlisting>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
-    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
-    &lt;groupId&gt;org.example.cayenne&lt;/groupId&gt;
-    &lt;artifactId&gt;tutorial-rop-client&lt;/artifactId&gt;
-    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
-
-    &lt;dependencies&gt;
-        &lt;dependency&gt;
-            &lt;groupId&gt;org.apache.cayenne&lt;/groupId&gt;
-            &lt;artifactId&gt;cayenne-client&lt;/artifactId&gt;
-            &lt;!-- Here specify the version of Cayenne you are actually using --&gt;
-            &lt;version&gt;3.1M3&lt;/version&gt;
-        &lt;/dependency&gt;
-        &lt;dependency&gt;
-        &lt;groupId&gt;com.caucho&lt;/groupId&gt;
-            &lt;artifactId&gt;resin-hessian&lt;/artifactId&gt;
-            &lt;version&gt;3.1.6&lt;/version&gt;
-        &lt;/dependency&gt;
-    &lt;/dependencies&gt;
-
-    &lt;repositories&gt;
-        &lt;repository&gt;
-            &lt;id&gt;caucho&lt;/id&gt;
-            &lt;name&gt;Caucho Repository&lt;/name&gt;
-            &lt;url&gt;http://caucho.com/m2&lt;/url&gt;
-            &lt;layout&gt;default&lt;/layout&gt;
-            &lt;snapshots&gt;
-                &lt;enabled&gt;false&lt;/enabled&gt;
-            &lt;/snapshots&gt;
-            &lt;releases&gt;
-                &lt;enabled&gt;true&lt;/enabled&gt;
-            &lt;/releases&gt;
-        &lt;/repository&gt;
-    &lt;/repositories&gt;
-&lt;/project&gt;</programlisting>
-        <para>Your computer must be connected to the internet. Once you save the pom.xml, Eclipse
-            will download the needed jar files and add them to the project build path. After that
-            all the errors should disappear.</para>
-        <para>Now let's check the entity class pairs. They look almost identical to their server
-            counterparts, although the superclass and the property access code are different. At
-            this point these differences are somewhat academic, so let's go on with the
-            tutorial.</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/index.xml b/docs/docbook/getting-started-rop/src/docbkx/index.xml
deleted file mode 100644
index 0825ea1..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/index.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?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.
--->
-<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-rop" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <info>
-        <title>Getting Started with Cayenne ROP (Remote Object Persistence)</title>
-        <copyright>
-            <year>2011-2016</year>
-            <holder>Apache Software Foundation and individual authors</holder>
-        </copyright>
-        <legalnotice>
-            <title>License</title>
-            <para>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</para>
-            
-            <para>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.</para>
-        </legalnotice>
-    </info>
-    <xi:include href="part1.xml"/>
-    <xi:include href="part2.xml"/>
-</book>
-

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/part1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/part1.xml b/docs/docbook/getting-started-rop/src/docbkx/part1.xml
deleted file mode 100644
index cf86a52..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/part1.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-rop-part1" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Prerequisites</title>
-    <xi:include href="setup.xml"/>
-</part>
-

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/part2.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/part2.xml b/docs/docbook/getting-started-rop/src/docbkx/part2.xml
deleted file mode 100644
index b2b27d7..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/part2.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-rop-part2" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Remote Object Persistence Quick Start</title>
-    <xi:include href="client-project.xml"/>
-    <xi:include href="web-service.xml"/>
-    <xi:include href="client-code.xml"/>
-    <xi:include href="authentification.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/setup.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/setup.xml b/docs/docbook/getting-started-rop/src/docbkx/setup.xml
deleted file mode 100644
index 4c5f5b9..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/setup.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Prerequisites</title>
-    <para>This tutorial starts where "Getting Started with Cayenne" left
-        off. If you have gone through the previous tutorial, and have the "tutorial" project open in
-        Eclipse, you can go directly to the 
-        next step. If not, here are the compressed instructions to prepare you for work
-        with ROP:</para>
-    <itemizedlist>
-        <listitem>
-            <para>
-                Step 1 - Eclipse Setup
-            </para>
-        </listitem>
-        <listitem>
-            <para>
-                Step 2 - Create a project
-            </para>
-        </listitem>
-        <listitem>
-            <para>
-               Step 3 - Create Cayenne OR Mapping
-            </para>
-        </listitem>
-        <listitem>
-            <para>
-                Step 4 - Create Java Classes
-            </para>
-        </listitem>
-        <listitem>
-            <para>
-                Step 5 - Convert the project to webapp.</para>
-        </listitem>
-    </itemizedlist>
-    <para>Note that at "Step 5" you can skip the JSP creation part. Just setup web.xml and
-        maven-jetty-plugin in the POM.</para>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/docbkx/web-service.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/web-service.xml b/docs/docbook/getting-started-rop/src/docbkx/web-service.xml
deleted file mode 100644
index 9532a04..0000000
--- a/docs/docbook/getting-started-rop/src/docbkx/web-service.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Setting up Hessian Web Service</title>
-    <section xml:id="setting-up-dependencies">
-        <title>Setting up Dependencies</title>
-        <para>Now lets get back to the "tutorial" project that contains a web application and set up
-            dependencies. The only extra one that we don't have yet is resin-hessian.jar, just like
-            the client, so let's add it (and the caucho repo declaration) to the pom.xml.</para>
-        <programlisting>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
-    ...
-    &lt;dependencies&gt;
-        ...
-        &lt;dependency&gt;
-            &lt;groupId&gt;com.caucho&lt;/groupId&gt;
-            &lt;artifactId&gt;resin-hessian&lt;/artifactId&gt;
-            &lt;version&gt;3.1.6&lt;/version&gt;
-        &lt;/dependency&gt;
-    &lt;/dependencies&gt;
-
-    &lt;build&gt;
-    ...
-    &lt;/build&gt;
-
-    &lt;repositories&gt;
-        &lt;repository&gt;
-            &lt;id&gt;caucho&lt;/id&gt;
-            &lt;name&gt;Caucho Repository&lt;/name&gt;
-            &lt;url&gt;http://caucho.com/m2&lt;/url&gt;
-            &lt;layout&gt;default&lt;/layout&gt;
-            &lt;snapshots&gt;
-                &lt;enabled&gt;false&lt;/enabled&gt;
-            &lt;/snapshots&gt;
-            &lt;releases&gt;
-                &lt;enabled&gt;true&lt;/enabled&gt;
-            &lt;/releases&gt;
-        &lt;/repository&gt;
-    &lt;/repositories&gt;
-    &lt;/project&gt;</programlisting>
-        
-        <note>
-            <para><emphasis role="bold">Maven Optimization
-                Hint</emphasis> On a real project both server and client modules will
-                likely share a common parent pom.xml where common repository delcaration can
-                be placed, with child pom's "inheriting" it from parent. This would reduce
-                build code duplication.</para>
-        </note>
-    </section>
-    <section xml:id="client-classes-on-server">
-        <title>Client Classes on the Server</title>
-        <para>Since ROP web service requires both server and client persistent classes, we need to
-            generate a second copy of the client classes inside the server project. This is a minor
-            inconvenience that will hopefully go away in the future versions of Cayenne. <emphasis
-                role="italic">Don't forget to refresh the project in Eclipse after class generation
-                is done.</emphasis></para>
-    </section>
-    <section xml:id="configuring-web-xml">
-        <title>Configuring web.xml</title>
-        <para>Cayenne web service is declared in the web.xml. It is implemented as a servlet
-            "org.apache.cayenne.configuration.rop.server.ROPHessianServlet". Open
-            tutorial/src/main/webapp/WEB-INF/web.xml in Eclipse and add a service declaration: </para>
-        <programlisting>&lt;?xml version="1.0" encoding="utf-8"?>
- &lt;!DOCTYPE web-app
-   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-   "http://java.sun.com/dtd/web-app_2_3.dtd">
-&lt;web-app>
-    &lt;display-name>Cayenne Tutorial&lt;/display-name>
-    &lt;servlet>
-        &lt;servlet-name>cayenne-project&lt;/servlet-name>
-        &lt;servlet-class>org.apache.cayenne.configuration.rop.server.ROPHessianServlet&lt;/servlet-class>
-        &lt;load-on-startup>0&lt;/load-on-startup>
-    &lt;/servlet>
-    &lt;servlet-mapping>
-        &lt;servlet-name>cayenne-project&lt;/servlet-name>
-        &lt;url-pattern>/cayenne-service&lt;/url-pattern>
-    &lt;/servlet-mapping>
-    &lt;/web-app></programlisting>
-        <note>
-            <para><emphasis role="bold">Extending Server Behavior via
-                Callbacks</emphasis> While no custom Java code is required on the
-                server, just a service declaration, it is possible to customizing
-                server-side behavior via callbacks and listeners (not shown in the
-                tutorial).</para>
-        </note>
-    </section>
-    <section xml:id="running-rop-server">
-        <title>Running ROP Server</title>
-        <para>Use previosly
-                created Eclipse Jetty run configuration available via "Run &gt; Run
-            Configurations..." (or create a new
-                one if none exists yet). You should see output in the Eclipse console similar
-            to the following:</para>
-        <programlisting>[INFO] Scanning for projects...
-[INFO]                                                                         
-[INFO] ------------------------------------------------------------------------
-[INFO] Building tutorial 0.0.1-SNAPSHOT
-[INFO] ------------------------------------------------------------------------
-...
-[INFO] Starting jetty 6.1.22 ...
-INFO::jetty-6.1.22
-INFO::No Transaction manager found - if your webapp requires one, please configure one.
-INFO::Started SelectChannelConnector@0.0.0.0:8080
-[INFO] Started Jetty Server
-INFO: Loading XML configuration resource from file:cayenne-project.xml
-INFO: loading user name and password.
-INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
-    Driver class: org.apache.derby.jdbc.EmbeddedDriver
-    Min. connections in the pool: 1
-    Max. connections in the pool: 1</programlisting>
-        <para>Cayenne ROP service URL is <emphasis role="italic"
-                >http://localhost:8080/tutorial/cayenne-service</emphasis>. If you click on it, you
-            will see "Hessian Requires POST" message, that means that the service is alive, but you
-            need a client other than the web browser to access it.</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started-rop/src/images/datamap-enableclient.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/images/datamap-enableclient.png b/docs/docbook/getting-started-rop/src/images/datamap-enableclient.png
deleted file mode 100644
index 62a2af2..0000000
Binary files a/docs/docbook/getting-started-rop/src/images/datamap-enableclient.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/pom.xml b/docs/docbook/getting-started/pom.xml
deleted file mode 100644
index 2cd301c..0000000
--- a/docs/docbook/getting-started/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.   
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.apache.cayenne.docs</groupId>
-		<artifactId>cayenne-docbook</artifactId>
-		<version>3.1.3-SNAPSHOT</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.cayenne.docs</groupId>
-	<artifactId>getting-started</artifactId>
-	<packaging>jar</packaging>
-	<name>Docbook: Getting Started with Cayenne</name>
-	
-	<build>
-		<resources>
-			<resource>
-				<directory>target/site</directory>
-			</resource>
-		</resources>
-	</build>
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/delete.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/delete.xml b/docs/docbook/getting-started/src/docbkx/delete.xml
deleted file mode 100644
index e699a9b..0000000
--- a/docs/docbook/getting-started/src/docbkx/delete.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Deleting Objects</title>
-    <para>This chapter explains how to model relationship delete rules and how to delete individual
-        objects as well as sets of objects. Also demonstrated the use of Cayenne class to run a
-        query.</para>
-    <section xml:id="setup-delete-rules">
-        <title>Setting Up Delete Rules</title>
-        <para>Before we discuss the API for object deletion, lets go back to CayenneModeler and set
-            up some delete rules. Doing this is optional but will simplify correct handling of the
-            objects related to deleted objects.</para>
-        <para>In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for
-            the "paintings" relationship delete rule:</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/modeler-deleterule.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject>
-        </para>
-        <para>Repeat this step for other relationships:</para>
-        <itemizedlist>
-            <listitem>
-                <para>For Gallery set "paintings" relationship to be "Nullify", as a painting can
-                    exist without being displayed in a gallery.</para>
-            </listitem>
-            <listitem>
-                <para>For Painting et both relationships rules to "Nullify".</para>
-            </listitem>
-        </itemizedlist>
-        <para>Now save the mapping, and refresh the project in Eclispe.</para>
-    </section>
-    <section xml:id="deleting-objects">
-        <title>Deleting Objects</title>
-        <para>While deleting objects is possible via SQL, qualifying a delete on one or more IDs, a
-            more common way in Cayenne (or ORM in general) is to get a hold of the object first, and
-            then delete it via the context. Let's use utility class Cayenne to find an
-            artist:</para>
-        <programlisting language="java">Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY, "Pablo Picasso");
-SelectQuery select = new SelectQuery(Artist.class, qualifier);
-Artist picasso = (Artist) Cayenne.objectForQuery(context, select);</programlisting>
-        <para>Now let's delete the artist:</para>
-        <programlisting language="java">if (picasso != null) {
-    context.deleteObject(picasso);
-    context.commitChanges();
-}</programlisting>
-        <para>Since we set up "Cascade" delete rule for the Artist.paintings relationships, Cayenne
-            will automatically delete all paintings of this artist. So when your run the app you'll
-            see this output:</para>
-        <programlisting>INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 
-      WHERE t0.NAME = ? [bind: 1->NAME:'Pablo Picasso'] - prepared in 6 ms.
-INFO: === returned 1 row. - took 18 ms.
-INFO: +++ transaction committed.
-INFO: --- transaction started.
-INFO: DELETE FROM PAINTING WHERE ID = ?
-INFO: [batch bind: 1->ID:200]
-INFO: [batch bind: 1->ID:201]
-INFO: === updated 2 rows.
-INFO: DELETE FROM ARTIST WHERE ID = ?
-INFO: [batch bind: 1->ID:200]
-INFO: === updated 1 row.
-INFO: +++ transaction committed.</programlisting>
-    </section>
-</chapter>


[11/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
CAY-2371 Switch documentation from Docbook to Asciidoctor format


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/7783cd34
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/7783cd34
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/7783cd34

Branch: refs/heads/STABLE-3.1
Commit: 7783cd34a0501595b5af26378e0dd7ae16efa003
Parents: 4cc7a6e
Author: Nikita Timofeev <st...@gmail.com>
Authored: Fri Jan 5 17:21:10 2018 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Fri Jan 5 17:21:11 2018 +0300

----------------------------------------------------------------------
 .../resources/assemblies/assembly-generic.xml   |   8 +-
 .../main/resources/assemblies/assembly-mac.xml  |   8 +-
 .../resources/assemblies/assembly-windows.xml   |   8 +-
 .../asciidoc/cayenne-asciidoc-extension/pom.xml |  43 ++
 .../cayenne/asciidoc/CayennePostProcessor.java  | 209 ++++++
 docs/asciidoc/cayenne-guide/pom.xml             | 151 ++++
 .../_cayenne-guide/configurationProperties.adoc | 118 ++++
 .../asciidoc/_cayenne-guide/expressionsBNF.adoc | 140 ++++
 .../docs/asciidoc/_cayenne-guide/header.html    |  23 +
 .../asciidoc/_cayenne-guide/listOfTables.adoc   |  25 +
 .../src/docs/asciidoc/_cayenne-guide/part1.adoc |  21 +
 .../asciidoc/_cayenne-guide/part1/mapping.adoc  |  70 ++
 .../asciidoc/_cayenne-guide/part1/modeler.adoc  |  42 ++
 .../asciidoc/_cayenne-guide/part1/setup.adoc    |  58 ++
 .../src/docs/asciidoc/_cayenne-guide/part2.adoc |  33 +
 .../_cayenne-guide/part2/customize.adoc         | 288 ++++++++
 .../_cayenne-guide/part2/expressions.adoc       | 244 +++++++
 .../_cayenne-guide/part2/including.adoc         | 394 +++++++++++
 .../_cayenne-guide/part2/lifecycle.adoc         | 280 ++++++++
 .../_cayenne-guide/part2/objectContext.adoc     | 309 +++++++++
 .../_cayenne-guide/part2/orderings.adoc         |  36 +
 .../asciidoc/_cayenne-guide/part2/queries.adoc  | 691 +++++++++++++++++++
 .../asciidoc/_cayenne-guide/part2/starting.adoc | 120 ++++
 .../asciidoc/_cayenne-guide/part2/tuning.adoc   | 269 ++++++++
 .../src/docs/asciidoc/_cayenne-guide/part3.adoc |  28 +
 .../_cayenne-guide/part3/clientImpl.adoc        |  16 +
 .../_cayenne-guide/part3/limitations.adoc       |  18 +
 .../docs/asciidoc/_cayenne-guide/part3/rop.adoc |  54 ++
 .../_cayenne-guide/part3/ropDeployment.adoc     |  34 +
 .../asciidoc/_cayenne-guide/part3/ropSetup.adoc |  20 +
 .../_cayenne-guide/part3/serverImpl.adoc        |  16 +
 .../_cayenne-guide/serviceCollections.adoc      |  62 ++
 .../src/docs/asciidoc/_cayenne-guide/var.adoc   |   1 +
 .../src/docs/asciidoc/cayenne-guide.adoc        |  47 ++
 .../asciidoc/images/ext-crypto-obj-entity.png   | Bin 0 -> 18145 bytes
 .../images/re-modeler-datasource-select.png     | Bin 0 -> 32658 bytes
 .../re-modeler-reverseengineering-dialog.png    | Bin 0 -> 37668 bytes
 .../images/remote-object-persistence.jpg        | Bin 0 -> 54407 bytes
 docs/asciidoc/getting-started-guide/pom.xml     | 170 +++++
 .../asciidoc/_getting-started-guide/delete.adoc |  72 ++
 .../asciidoc/_getting-started-guide/header.html |  24 +
 .../_getting-started-guide/java-classes.adoc    |  70 ++
 .../_getting-started-guide/object-context.adoc  |  86 +++
 .../object-relational-mapping.adoc              | 111 +++
 .../asciidoc/_getting-started-guide/part2.adoc  |  20 +
 .../asciidoc/_getting-started-guide/part3.adoc  |  22 +
 .../persistent-objects.adoc                     | 119 ++++
 .../_getting-started-guide/select-query.adoc    |  63 ++
 .../asciidoc/_getting-started-guide/setup.adoc  |  31 +
 .../starting-project.adoc                       |  93 +++
 .../asciidoc/_getting-started-guide/var.adoc    |   1 +
 .../asciidoc/_getting-started-guide/webapp.adoc | 284 ++++++++
 .../docs/asciidoc/getting-started-guide.adoc    |  48 ++
 .../src/docs/asciidoc/images/base-datamap.png   | Bin 0 -> 91074 bytes
 .../src/docs/asciidoc/images/base-datanode.png  | Bin 0 -> 81748 bytes
 .../asciidoc/images/cayenne-tutorial-model.png  | Bin 0 -> 18875 bytes
 .../docs/asciidoc/images/database-schema.jpg    | Bin 0 -> 28434 bytes
 .../asciidoc/images/datamap-enableclient.png    | Bin 0 -> 104778 bytes
 .../images/eclipse-generatedclasses.png         | Bin 0 -> 141000 bytes
 .../src/docs/asciidoc/images/eclipse-mvnrun.png | Bin 0 -> 147012 bytes
 .../docs/asciidoc/images/eclipse-xmlfiles.png   | Bin 0 -> 27801 bytes
 .../src/docs/asciidoc/images/firefox-webapp.png | Bin 0 -> 25898 bytes
 .../src/docs/asciidoc/images/icon-attribute.png | Bin 0 -> 293 bytes
 .../src/docs/asciidoc/images/icon-datamap.png   | Bin 0 -> 411 bytes
 .../src/docs/asciidoc/images/icon-dbentity.png  | Bin 0 -> 142 bytes
 .../src/docs/asciidoc/images/icon-edit.png      | Bin 0 -> 340 bytes
 .../docs/asciidoc/images/icon-new_objentity.png | Bin 0 -> 563 bytes
 .../src/docs/asciidoc/images/icon-node.png      | Bin 0 -> 350 bytes
 .../docs/asciidoc/images/icon-relationship.png  | Bin 0 -> 347 bytes
 .../src/docs/asciidoc/images/icon-sync.png      | Bin 0 -> 280 bytes
 .../docs/asciidoc/images/idea-file-run-menu.png | Bin 0 -> 32911 bytes
 .../asciidoc/images/idea-run-configuration.png  | Bin 0 -> 93059 bytes
 .../asciidoc/images/maven-plugin-install.png    | Bin 0 -> 97455 bytes
 .../docs/asciidoc/images/modeler-artistid.png   | Bin 0 -> 59372 bytes
 .../asciidoc/images/modeler-dbrelationship.png  | Bin 0 -> 42245 bytes
 .../docs/asciidoc/images/modeler-deleterule.png | Bin 0 -> 69992 bytes
 .../docs/asciidoc/images/modeler-started.png    | Bin 0 -> 133410 bytes
 .../asciidoc/images/tutorial-idea-project.png   | Bin 0 -> 70937 bytes
 docs/asciidoc/getting-started-rop/pom.xml       | 151 ++++
 .../asciidoc/_getting-started-rop/header.html   |  24 +
 .../asciidoc/_getting-started-rop/part1.adoc    |  17 +
 .../part1/prerequisites.adoc                    |  25 +
 .../asciidoc/_getting-started-rop/part2.adoc    |  23 +
 .../_getting-started-rop/part2/adding.adoc      | 129 ++++
 .../_getting-started-rop/part2/connect.adoc     | 176 +++++
 .../part2/hessianWebServ.adoc                   | 113 +++
 .../_getting-started-rop/part2/starting.adoc    |  93 +++
 .../docs/asciidoc/_getting-started-rop/var.adoc |   1 +
 .../src/docs/asciidoc/getting-started-rop.adoc  |  45 ++
 .../asciidoc/images/datamap-enableclient.png    | Bin 0 -> 104778 bytes
 docs/asciidoc/pom.xml                           | 113 +++
 docs/asciidoc/upgrade-guide/pom.xml             | 151 ++++
 .../_upgrade-guide/cayenne-configuration.adoc   |  47 ++
 .../_upgrade-guide/content-structure.adoc       |  26 +
 .../docs/asciidoc/_upgrade-guide/features.adoc  |  25 +
 .../docs/asciidoc/_upgrade-guide/framework.adoc |  75 ++
 .../docs/asciidoc/_upgrade-guide/header.html    |  24 +
 .../docs/asciidoc/_upgrade-guide/lifecycle.adoc |  18 +
 .../docs/asciidoc/_upgrade-guide/modeler.adoc   |  20 +
 .../src/docs/asciidoc/upgrade-guide.adoc        |  44 ++
 docs/docbook/cayenne-guide/pom.xml              |  31 -
 .../cayenne-guide/src/docbkx/appendix-a.xml     | 184 -----
 .../cayenne-guide/src/docbkx/appendix-b.xml     | 100 ---
 .../cayenne-guide/src/docbkx/appendix-c.xml     | 147 ----
 .../src/docbkx/cayenne-mapping-structure.xml    |  95 ---
 .../src/docbkx/cayennemodeler-application.xml   |  60 --
 .../src/docbkx/current-limitations.xml          |  20 -
 .../src/docbkx/customizing-cayenne-runtime.xml  | 279 --------
 .../cayenne-guide/src/docbkx/expressions.xml    | 265 -------
 .../src/docbkx/implementing-rop-client.xml      |  20 -
 .../src/docbkx/implementing-rop-server.xml      |  20 -
 .../src/docbkx/including-cayenne-in-project.xml | 546 ---------------
 docs/docbook/cayenne-guide/src/docbkx/index.xml |  46 --
 .../src/docbkx/lifecycle-events.xml             | 333 ---------
 .../cayenne-guide/src/docbkx/orderings.xml      |  31 -
 docs/docbook/cayenne-guide/src/docbkx/part1.xml |  23 -
 docs/docbook/cayenne-guide/src/docbkx/part2.xml |  29 -
 docs/docbook/cayenne-guide/src/docbkx/part3.xml |  26 -
 .../src/docbkx/performance-tuning.xml           | 289 --------
 .../docbkx/persistent-objects-objectcontext.xml | 300 --------
 .../cayenne-guide/src/docbkx/queries.xml        | 628 -----------------
 .../cayenne-guide/src/docbkx/rop-deployment.xml |  47 --
 .../src/docbkx/rop-introduction.xml             |  98 ---
 .../cayenne-guide/src/docbkx/rop-setup.xml      |  26 -
 docs/docbook/cayenne-guide/src/docbkx/setup.xml |  82 ---
 .../src/docbkx/starting-cayenne.xml             | 158 -----
 .../docbook/cayenne-guide/src/images/.gitignore |   0
 .../src/images/remote-object-persistence.jpg    | Bin 54407 -> 0 bytes
 docs/docbook/docbook-stylesheets/pom.xml        |  47 --
 .../src/main/resources/css/cayenne-doc.css      | 140 ----
 .../src/main/resources/css/highlight.css        |  35 -
 .../stylesheets/common-customizations.xsl       |  32 -
 .../main/resources/stylesheets/highlight.xsl    | 104 ---
 .../src/main/resources/stylesheets/html.xsl     | 244 -------
 .../src/main/resources/stylesheets/pdf.xsl      | 505 --------------
 docs/docbook/getting-started-rop/pom.xml        |  40 --
 .../src/docbkx/authentification.xml             | 131 ----
 .../src/docbkx/client-code.xml                  | 161 -----
 .../src/docbkx/client-project.xml               | 131 ----
 .../getting-started-rop/src/docbkx/index.xml    |  43 --
 .../getting-started-rop/src/docbkx/part1.xml    |  22 -
 .../getting-started-rop/src/docbkx/part2.xml    |  24 -
 .../getting-started-rop/src/docbkx/setup.xml    |  53 --
 .../src/docbkx/web-service.xml                  | 131 ----
 .../src/images/datamap-enableclient.png         | Bin 104778 -> 0 bytes
 docs/docbook/getting-started/pom.xml            |  40 --
 .../getting-started/src/docbkx/delete.xml       |  80 ---
 .../getting-started/src/docbkx/index.xml        |  44 --
 .../getting-started/src/docbkx/java-classes.xml |  99 ---
 .../src/docbkx/object-context.xml               |  92 ---
 .../src/docbkx/object-relational-mapping.xml    | 163 -----
 .../getting-started/src/docbkx/part1.xml        |  21 -
 .../getting-started/src/docbkx/part2.xml        |  25 -
 .../getting-started/src/docbkx/part3.xml        |  26 -
 .../getting-started/src/docbkx/part4.xml        |  22 -
 .../src/docbkx/persistent-objects.xml           | 146 ----
 .../getting-started/src/docbkx/select-query.xml |  69 --
 .../getting-started/src/docbkx/setup.xml        |  50 --
 .../src/docbkx/starting-project.xml             | 151 ----
 .../getting-started/src/docbkx/webapp.xml       | 301 --------
 .../getting-started/src/images/base-datamap.png | Bin 91074 -> 0 bytes
 .../src/images/base-datanode.png                | Bin 81748 -> 0 bytes
 .../src/images/database-schema.jpg              | Bin 28434 -> 0 bytes
 .../src/images/eclipse-generatedclasses.png     | Bin 141000 -> 0 bytes
 .../src/images/eclipse-mvnrun.png               | Bin 147012 -> 0 bytes
 .../src/images/eclipse-xmlfiles.png             | Bin 27801 -> 0 bytes
 .../src/images/firefox-webapp.png               | Bin 25898 -> 0 bytes
 .../src/images/maven-plugin-install.png         | Bin 97455 -> 0 bytes
 .../src/images/modeler-artistid.png             | Bin 59372 -> 0 bytes
 .../src/images/modeler-dbrelationship.png       | Bin 42245 -> 0 bytes
 .../src/images/modeler-deleterule.png           | Bin 69992 -> 0 bytes
 .../src/images/modeler-started.png              | Bin 133410 -> 0 bytes
 .../src/images/tutorial-eclipse-project.png     | Bin 70937 -> 0 bytes
 docs/docbook/pom.xml                            | 173 -----
 docs/docbook/upgrade-guide/pom.xml              |  39 --
 docs/docbook/upgrade-guide/src/docbkx/index.xml |  27 -
 .../upgrade-guide/src/docbkx/new-features.xml   | 162 -----
 .../docbook/upgrade-guide/src/images/.gitignore |   2 -
 docs/pom.xml                                    |   2 +-
 .../java/org/apache/cayenne/tutorial/Main.java  |   8 +
 .../cayenne/tutorial/persistent/Artist.java     |   2 +
 tutorials/tutorial/src/main/webapp/detail.jsp   |   4 +-
 tutorials/tutorial/src/main/webapp/index.jsp    |   4 +-
 183 files changed, 6443 insertions(+), 7473 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/assembly/src/main/resources/assemblies/assembly-generic.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/resources/assemblies/assembly-generic.xml b/assembly/src/main/resources/assemblies/assembly-generic.xml
index 6d33d20..ecf1c72 100644
--- a/assembly/src/main/resources/assemblies/assembly-generic.xml
+++ b/assembly/src/main/resources/assemblies/assembly-generic.xml
@@ -48,22 +48,22 @@
 
 	<files>
 		<file>
-			<source>../docs/docbook/getting-started/target/site/getting-started.pdf</source>
+			<source>../docs/asciidoc/getting-started-guide/target/generated-docs/getting-started-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/getting-started-rop/target/site/getting-started-rop.pdf</source>
+			<source>../docs/asciidoc/getting-started-rop/target/generated-docs/getting-started-rop.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started-rop.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/cayenne-guide/target/site/cayenne-guide.pdf</source>
+			<source>../docs/asciidoc/cayenne-guide/target/generated-docs/cayenne-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>cayenne-guide.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/upgrade-guide/target/site/upgrade-guide.pdf</source>
+			<source>../docs/asciidoc/upgrade-guide/target/generated-docs/upgrade-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>upgrade-guide.pdf</destName>
 		</file>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/assembly/src/main/resources/assemblies/assembly-mac.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/resources/assemblies/assembly-mac.xml b/assembly/src/main/resources/assemblies/assembly-mac.xml
index 91c4b52..c74b7e7 100644
--- a/assembly/src/main/resources/assemblies/assembly-mac.xml
+++ b/assembly/src/main/resources/assemblies/assembly-mac.xml
@@ -48,22 +48,22 @@
 
 	<files>
 		<file>
-			<source>../docs/docbook/getting-started/target/site/getting-started.pdf</source>
+			<source>../docs/asciidoc/getting-started-guide/target/generated-docs/getting-started-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/getting-started-rop/target/site/getting-started-rop.pdf</source>
+			<source>../docs/asciidoc/getting-started-rop/target/generated-docs/getting-started-rop.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started-rop.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/cayenne-guide/target/site/cayenne-guide.pdf</source>
+			<source>../docs/asciidoc/cayenne-guide/target/generated-docs/cayenne-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>cayenne-guide.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/upgrade-guide/target/site/upgrade-guide.pdf</source>
+			<source>../docs/asciidoc/upgrade-guide/target/generated-docs/upgrade-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>upgrade-guide.pdf</destName>
 		</file>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/assembly/src/main/resources/assemblies/assembly-windows.xml
----------------------------------------------------------------------
diff --git a/assembly/src/main/resources/assemblies/assembly-windows.xml b/assembly/src/main/resources/assemblies/assembly-windows.xml
index 586ce7a..5878b90 100644
--- a/assembly/src/main/resources/assemblies/assembly-windows.xml
+++ b/assembly/src/main/resources/assemblies/assembly-windows.xml
@@ -48,22 +48,22 @@
 
 	<files>
 		<file>
-			<source>../docs/docbook/getting-started/target/site/getting-started.pdf</source>
+			<source>../docs/asciidoc/getting-started-guide/target/generated-docs/getting-started-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/getting-started-rop/target/site/getting-started-rop.pdf</source>
+			<source>../docs/asciidoc/getting-started-rop/target/generated-docs/getting-started-rop.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>getting-started-rop.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/cayenne-guide/target/site/cayenne-guide.pdf</source>
+			<source>../docs/asciidoc/cayenne-guide/target/generated-docs/cayenne-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>cayenne-guide.pdf</destName>
 		</file>
 		<file>
-			<source>../docs/docbook/upgrade-guide/target/site/upgrade-guide.pdf</source>
+			<source>../docs/asciidoc/upgrade-guide/target/generated-docs/upgrade-guide.pdf</source>
 			<outputDirectory>doc</outputDirectory>
 			<destName>upgrade-guide.pdf</destName>
 		</file>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-asciidoc-extension/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-asciidoc-extension/pom.xml b/docs/asciidoc/cayenne-asciidoc-extension/pom.xml
new file mode 100644
index 0000000..5e66e6d
--- /dev/null
+++ b/docs/asciidoc/cayenne-asciidoc-extension/pom.xml
@@ -0,0 +1,43 @@
+<?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.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.docs</groupId>
+        <artifactId>cayenne-asciidoc-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>cayenne-asciidoc-extension</artifactId>
+    <description>AsciidoctorJ extension for website version of Cayenne documentation</description>
+    <packaging>jar</packaging>
+    <modelVersion>4.0.0</modelVersion>
+
+    <dependencies>
+        <dependency>
+            <!-- jsoup HTML parser library @ https://jsoup.org/ -->
+            <groupId>org.jsoup</groupId>
+            <artifactId>jsoup</artifactId>
+            <version>1.11.2</version>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java b/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
new file mode 100644
index 0000000..4689dbd
--- /dev/null
+++ b/docs/asciidoc/cayenne-asciidoc-extension/src/main/java/org/apache/cayenne/asciidoc/CayennePostProcessor.java
@@ -0,0 +1,209 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.asciidoc;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.util.Collections;
+import java.util.Map;
+
+import org.asciidoctor.Options;
+import org.asciidoctor.ast.Document;
+import org.asciidoctor.ast.DocumentRuby;
+import org.asciidoctor.extension.Postprocessor;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Element;
+
+/**
+ * <p>
+ * AsciidoctorJ post processor, that extracts ToC into separate file and optionally can inject content into rendered document.
+ * Can be used only for HTML backend, will <b>fail</b> if used with PDF.
+ * <p>
+ * It is targeted to inject "front-matter" section suitable for cayenne website tools.
+ * <p>
+ * Extension controlled by attributes in *.adoc file:
+ * <ul>
+ *     <li>cayenne-header: header file name or constant "front-matter" that will inject empty front matter markup
+ *     <li>cayenne-header-position [optional]: "top" to inject just above all content or "body" to inject right after &gt;body&lt; tag
+ *     <li>cayenne-footer: footer file name or constant "front-matter" that will inject empty front matter markup
+ *     <li>cayenne-footer-position [optional]: "bottom" to inject just after all content or "body" to inject right before &gt;/body&lt; tag
+ * </ul>
+ *
+ */
+public class CayennePostProcessor extends Postprocessor {
+
+    private static final String FRONT_MATTER = "front-matter";
+    private static final String EMPTY_FRONT_MATTER = "---\n---\n\n";
+    private static final String POSITION_TOP = "top";
+    private static final String POSITION_BODY = "body";
+    private static final String POSITION_BOTTOM = "bottom";
+
+    public CayennePostProcessor(DocumentRuby documentRuby) {
+        super();
+    }
+
+    public String process(Document document, String output) {
+        output = extractTableOfContents(document, output);
+        output = fixupDom(document, output);
+        output = processHeader(document, output);
+        output = processFooter(document, output);
+        return output;
+    }
+
+    private String fixupDom(Document document, String output) {
+        org.jsoup.nodes.Document jsoupDoc = Jsoup.parseBodyFragment(output);
+
+        jsoupDoc.select(".icon-note")
+                .removeClass("icon-note")
+                .addClass("fa-info-circle")
+                .addClass("fa-2x");
+
+        jsoupDoc.select(".icon-tip")
+                .removeClass("icon-tip")
+                .addClass("fa-lightbulb-o")
+                .addClass("fa-2x");
+
+        for(Element el : jsoupDoc.select("code")) {
+            String codeClass = el.attr("data-lang");
+            if(!codeClass.isEmpty()) {
+                el.addClass(codeClass);
+            }
+        }
+
+        jsoupDoc.select("div#preamble").remove();
+
+        return jsoupDoc.body().html();
+    }
+
+    protected String extractTableOfContents(Document document, String output) {
+        int start = output.indexOf("<div id=\"toc\" class=\"toc\">");
+        if(start == -1) {
+            // no toc found, exit
+            return output;
+        }
+
+        String tocEndString = "</ul>\n</div>";
+        int end = output.indexOf(tocEndString, start);
+        if(end == -1) {
+            // bad, no end..
+            return output;
+        }
+
+        end += tocEndString.length() + 1;
+
+        org.jsoup.nodes.Document tocDoc = Jsoup.parseBodyFragment(output.substring(start, end));
+        tocDoc.select("ul").addClass("nav");
+        tocDoc.select("a").addClass("nav-link");
+        tocDoc.select("div#toc").addClass("toc-side");
+        String toc = tocDoc.body().html();
+
+        Object destDir = document.getOptions().get(Options.DESTINATION_DIR);
+        Object docname = ((Map)document.getOptions().get(Options.ATTRIBUTES)).get("docname");
+
+        Path path = FileSystems.getDefault().getPath((String) destDir, docname + ".toc.html");
+        try(BufferedWriter br = newBufferedWriter(path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE)) {
+            br.write(toc, 0, toc.length());
+            br.flush();
+        } catch (IOException ex) {
+            ex.printStackTrace(System.err);
+        }
+
+        if(start == 0) {
+            return output.substring(end);
+        }
+
+        return output.substring(0, start) + output.substring(end);
+    }
+
+    public static BufferedWriter newBufferedWriter(Path path, OpenOption... options) throws IOException {
+        CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
+        Writer writer = new OutputStreamWriter(path.getFileSystem().provider().newOutputStream(path, options), encoder);
+        return new BufferedWriter(writer);
+    }
+
+    protected String processHeader(Document document, String output) {
+        String headerFile = (String) document.getAttr("cayenne-header", "");
+        String headerPosition = (String)document.getAttr("cayenne-header-position", POSITION_TOP);
+
+        if(headerFile.isEmpty()) {
+            return output;
+        }
+
+        String header = "";
+        // inject empty front matter
+        if(FRONT_MATTER.equals(headerFile.trim())) {
+            header = EMPTY_FRONT_MATTER ;
+        } else {
+            // treat as a file
+            header = document.readAsset(headerFile, Collections.emptyMap());
+        }
+
+        switch (headerPosition.trim()) {
+            case POSITION_BODY: {
+                int bodyStart = output.indexOf("<div id=\"header\">");
+                if(bodyStart == -1) {
+                    // no header
+                    return header + output;
+                }
+                return output.substring(0, bodyStart) + header + output.substring(bodyStart);
+            }
+
+            case POSITION_TOP:
+            default:
+                return header + output;
+        }
+    }
+
+    protected String processFooter(Document document, String output) {
+        String footerFile = (String) document.getAttr("cayenne-footer", "");
+        String footerPosition = (String)document.getAttr("cayenne-footer-position", POSITION_BOTTOM);
+
+        if(footerFile.isEmpty()) {
+            return output;
+        }
+
+        String footer = document.readAsset(footerFile, Collections.emptyMap());
+
+        switch (footerPosition.trim()) {
+            case POSITION_BODY: {
+                int bodyStart = output.indexOf("</body>");
+                if(bodyStart == -1) {
+                    // no footer
+                    return output + footer;
+                }
+                return output.substring(0, bodyStart) + footer + output.substring(bodyStart);
+            }
+
+            case POSITION_BOTTOM:
+            default:
+                return output + footer;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/pom.xml b/docs/asciidoc/cayenne-guide/pom.xml
new file mode 100644
index 0000000..99f75c1
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/pom.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.parents</groupId>
+        <artifactId>cayenne-asciidoc-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>cayenne-guide</artifactId>
+
+    <packaging>jar</packaging>
+    <name>cayenne-guide: AsciiDoc - Cayenne Framework Guide</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.asciidoctor</groupId>
+                <artifactId>asciidoctor-maven-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cayenne.docs</groupId>
+                        <artifactId>cayenne-asciidoc-extension</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <!-- generate "embeddable" html content with front matter and without header/footer/styles -->
+                    <execution>
+                        <id>asciidoctor-html-web</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>process-asciidoc</goal>
+                        </goals>
+                        <configuration>
+                            <backend>html5</backend>
+                            <headerFooter>false</headerFooter> <!-- do not generate header and footer -->
+                            <outputDirectory>${project.build.directory}/tmp/</outputDirectory>
+                            <extensions>
+                                <extension>
+                                    <className>org.apache.cayenne.asciidoc.CayennePostProcessor</className>
+                                </extension>
+                            </extensions>
+                            <attributes>
+                                <toc>auto</toc>
+                            </attributes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Move images to proper path for site -->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy docs for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/</directory>
+                                    <includes>
+                                        <include>${project.artifactId}.html</include>
+                                        <include>${project.artifactId}.toc.html</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy images for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/${project.artifactId}/images/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/images/</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>assembly</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.asciidoctor</groupId>
+                        <artifactId>asciidoctor-maven-plugin</artifactId>
+                        <executions>
+                            <!-- generate standalone html help -->
+                            <execution>
+                                <id>asciidoctor-html-standalone</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>html5</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <embedAssets>true</embedAssets>
+                                    <attributes>
+                                        <toc>left</toc>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+
+                            <!-- generate PDF -->
+                            <execution>
+                                <id>generate-pdf-doc</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>pdf</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <attributes>
+                                        <pagenums/>
+                                        <toc/>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/configurationProperties.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/configurationProperties.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/configurationProperties.adoc
new file mode 100644
index 0000000..d73c8c8
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/configurationProperties.adoc
@@ -0,0 +1,118 @@
+// 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.
+
+== Appendix A. Configuration Properties
+
+Note that the property names below are defined as constants in `org.apache.cayenne.configuration.Constants` interface.
+
+[#configProperties]
+* `cayenne.jdbc.driver[.domain_name.node_name]`
+   defines a JDBC driver class to use when creating a DataSource. If domain name and optionally - node name are specified,
+   the setting overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system.
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.jdbc.url[.domain_name.node_name]`
+    defines a DB URL to use when creating a DataSource. If domain name and optionally - node name are specified,
+    the setting overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system.
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.jdbc.username[.domain_name.node_name]`
+   defines a DB user name to use when creating a DataSource. If domain name and optionally - node name are specified,
+   the setting overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system.
+    ** Possible values: any
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.jdbc.password[.domain_name.node_name]`
+   defines a DB password to use when creating a DataSource. If domain name and optionally - node name are specified,
+   the setting overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.jdbc.min_connections[.domain_name.node_name]`
+   defines the DB connection pool minimal size. If domain name and optionally - node name are specified, the setting
+   overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.jdbc.max_connections[.domain_name.node_name]`
+   defines the DB connection pool maximum size. If domain name and optionally - node name are specified, the setting
+   overrides DataSource info just for this domain/node. Otherwise the override is applied to all domains/nodes in the system
+    ** Default value: none, project DataNode configuration is used
+
+* `cayenne.querycache.size`
+   An integer defining the maximum number of entries in the query cache. Note that not all QueryCache providers may respect this property.
+   MapQueryCache uses it, but the rest would use alternative configuration methods.
+    ** Possible values: any positive int value
+    ** Default value: 2000
+
+* `cayenne.server.contexts_sync_strategy`
+   defines whether peer ObjectContexts should receive snapshot events after commits from other contexts. If true (_default_),
+   the contexts would automatically synchronize their state with peers.
+    ** Possible values: true, false
+    ** Default value: true
+
+* `cayenne.server.object_retain_strategy`
+   defines fetched objects retain strategy for ObjectContexts. When weak or soft strategy is used, objects retained by ObjectContext
+   that have no local changes can potentially get garbage collected when JVM feels like doing it.
+    ** Possible values: weak, soft, hard
+    ** Default value: weak
+
+* `cayenne.server.max_id_qualifier_size`
+   defines a maximum number of ID qualifiers in the WHERE clause of queries that are generated for paginated queries and for DISJOINT_BY_ID prefetch processing.
+   This is needed to avoid hitting WHERE clause size limitations and memory usage efficiency.
+    ** Possible values: any positive int
+    ** Default value: 10000
+
+* `cayenne.rop.service_url`
+   defines the URL of the ROP server
+    ** Default value: none
+
+* `cayenne.rop.service_username`
+   defines the user name for an ROP client to login to an ROP server.
+    ** Default value: none
+
+* `cayenne.rop.service_password`
+   defines the password for an ROP client to login to an ROP server.
+    ** Default value: none
+
+* `cayenne.rop.service.timeout`
+   a value in milliseconds for the ROP client-server connection read operation timeout
+    ** Possible values: any positive long value
+    ** Default value: none
+
+* `cayenne.rop.shared_session_name`
+   defines the name of the shared session that an ROP client wants to join on an ROP server. If omitted, a dedicated session is created.
+    ** Default value: none
+
+* `cayenne.rop.channel_events`
+   defines whether client-side DataChannel should dispatch events to child ObjectContexts.
+   If set to true, ObjectContexts will receive commit events and merge changes committed by peer contexts that passed through the common client DataChannel.
+    ** Possible values: true, false
+    ** Default value: false
+
+* `cayenne.rop.context_change_events`
+   defines whether object property changes in the client context result in firing events. Client UI components can listen to these events and update the UI. Disabled by default.
+    ** Possible values: true, false
+    ** Default value: false
+
+* `cayenne.rop.context_lifecycle_events`
+   defines whether object commit and rollback operations in the client context result in firing events.
+   Client UI components can listen to these events and update the UI. Disabled by default.
+    ** Possible values: true,false
+    ** Default value: false
+
+* `cayenne.server.rop_event_bridge_factory`
+   defines the name of the `org.apache.cayenne.event.EventBridgeFactory` that is passed from the ROP server to the client.
+   I.e. server DI would provide a name of the factory, passing this name to the client via the wire.
+   The client would instantiate it to receive events from the server. Note that this property is stored
+   in `cayenne.server.rop_event_bridge_properties` map, not in the main `cayenne.properties`.
+   ** Default value: false
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/expressionsBNF.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/expressionsBNF.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/expressionsBNF.adoc
new file mode 100644
index 0000000..ee3726a
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/expressionsBNF.adoc
@@ -0,0 +1,140 @@
+// 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.
+
+== Appendix C. Expressions BNF
+
+[source]
+----
+TOKENS
+<DEFAULT> SKIP : {
+" "
+| "\t"
+| "\n"
+| "\r"
+}
+
+<DEFAULT> TOKEN : {
+<NULL: "null" | "NULL">
+| <TRUE: "true" | "TRUE">
+| <FALSE: "false" | "FALSE">
+}
+
+<DEFAULT> TOKEN : {
+<PROPERTY_PATH: <IDENTIFIER> ("." <IDENTIFIER>)*>
+}
+
+<DEFAULT> TOKEN : {
+<IDENTIFIER: <LETTER> (<LETTER> | <DIGIT>)* (["+"])?>
+| <#LETTER: ["_","a"-"z","A"-"Z"]>
+| <#DIGIT: ["0"-"9"]>
+}
+
+/**
+ * Quoted Strings, whose object value is stored in the token manager's
+ * "literalValue" field. Both single and double qoutes are allowed
+ */<DEFAULT> MORE : {
+"\'" : WithinSingleQuoteLiteral
+| "\"" : WithinDoubleQuoteLiteral
+}
+
+<WithinSingleQuoteLiteral> MORE : {
+<ESC: "\\" (["n","r","t","b","f","\\","\'","`","\""] | (["0"-"3"])? ["0"-"7"] (["0"-"7"])?)> : {
+| <~["\'","\\"]> : {
+}
+
+<WithinSingleQuoteLiteral> TOKEN : {
+<SINGLE_QUOTED_STRING: "\'"> : DEFAULT
+}
+
+<WithinDoubleQuoteLiteral> MORE : {
+<STRING_ESC: <ESC>> : {
+| <~["\"","\\"]> : {
+}
+
+<WithinDoubleQuoteLiteral> TOKEN : {
+<DOUBLE_QUOTED_STRING: "\""> : DEFAULT
+}
+
+/**
+ * Integer or real Numeric literal, whose object value is stored in the token manager's
+ * "literalValue" field.
+ */<DEFAULT> TOKEN : {
+<INT_LITERAL: ("0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+)
+        (["l","L","h","H"])?> : {
+| <FLOAT_LITERAL: <DEC_FLT> (<EXPONENT>)? (<FLT_SUFF>)? | <DEC_DIGITS> <EXPONENT> (<FLT_SUFF>)?
+| <DEC_DIGITS> <FLT_SUFF>> : {
+| <#DEC_FLT: (["0"-"9"])+ "." (["0"-"9"])* | "." (["0"-"9"])+>
+| <#DEC_DIGITS: (["0"-"9"])+>
+| <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
+| <#FLT_SUFF: ["d","D","f","F","b","B"]>
+}
+
+NON-TERMINALS
+    expression    :=    orCondition <EOF>
+    orCondition    :=    andCondition ( "or" andCondition )*
+    andCondition    :=    notCondition ( "and" notCondition )*
+    notCondition    :=    ( "not" | "!" ) simpleCondition
+        |    simpleCondition
+    simpleCondition    :=    <TRUE>
+        |    <FALSE>
+        |    scalarConditionExpression
+             ( simpleNotCondition
+               | ( "=" | "==" ) scalarExpression
+               | ( "!=" | "<>" ) scalarExpression
+               | "<=" scalarExpression
+               | "<" scalarExpression | ">" scalarExpression
+               | ">=" scalarExpression
+               | "like" scalarExpression
+               | "likeIgnoreCase" scalarExpression
+               | "in" ( namedParameter | "(" scalarCommaList ")" )
+               | "between" scalarExpression "and" scalarExpression
+             )?
+    simpleNotCondition    :=    ( "not" | "!" )
+             ( "like" scalarExpression
+               | "likeIgnoreCase" scalarExpression
+               | "in" ( namedParameter | "(" scalarCommaList ")" )
+               | "between" scalarExpression "and" scalarExpression
+             )
+    scalarCommaList    :=    ( scalarConstExpression ( "," scalarConstExpression )* )
+    scalarConditionExpression    :=    scalarNumericExpression
+        |    <SINGLE_QUOTED_STRING>
+        |    <DOUBLE_QUOTED_STRING>
+        |    <NULL>
+    scalarExpression    :=    scalarConditionExpression
+        |    <TRUE>
+        |    <FALSE>
+    scalarConstExpression    :=    <SINGLE_QUOTED_STRING>
+        |    <DOUBLE_QUOTED_STRING>
+        |    namedParameter
+        |    <INT_LITERAL>
+        |    <FLOAT_LITERAL>
+        |    <TRUE>
+        |    <FALSE>
+    scalarNumericExpression    :=    multiplySubtractExp
+             ( "+" multiplySubtractExp | "-" multiplySubtractExp )*
+    multiplySubtractExp    :=    numericTerm ( "*" numericTerm | "/" numericTerm )*
+    numericTerm    :=    ( "+" )? numericPrimary
+        |    "-" numericPrimary
+    numericPrimary    :=    "(" orCondition ")"
+        |    pathExpression
+        |    namedParameter
+        |    <INT_LITERAL>
+        |    <FLOAT_LITERAL>
+    namedParameter    :=    "$" <PROPERTY_PATH>
+    pathExpression    :=    ( <PROPERTY_PATH>
+                            | "obj:" <PROPERTY_PATH>
+                            | "db:" <PROPERTY_PATH>
+                            | "enum:" <PROPERTY_PATH>  )
+----
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
new file mode 100644
index 0000000..3bea7ad
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/header.html
@@ -0,0 +1,23 @@
+---
+#  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.
+
+title: "Cayenne Guide"
+description: "Cayenne Guide"
+cayenneVersion: "3.1"
+weight: 20
+---

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/listOfTables.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/listOfTables.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/listOfTables.adoc
new file mode 100644
index 0000000..66d27be
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/listOfTables.adoc
@@ -0,0 +1,25 @@
+// 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.
+
+== List of tables
+
+* xref:tablecgen[cgen required parameters]
+* xref:cgenOptional[cgen optional parameters]
+* xref:cdbgenTable[cdbgen required parameters]
+* xref:cdbgenOptionl[cdbgen optional parameters]
+* xref:cdbimportTable[cdbimport parameters]
+* xref:persistenceStates[Persistence States]
+* xref:lifecycleEvent[Lifecycle Event Types]
+* xref:congigProperties[Configuration Properties Recognized by ServerRuntime and/or ClientRuntime]
+* xref:serviceCollections[Service Collection Keys Present in ServerRuntime and/or ClientRuntime]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1.adoc
new file mode 100644
index 0000000..a99d627
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1.adoc
@@ -0,0 +1,21 @@
+// 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.
+
+== Object Relational Mapping with Cayenne
+
+include::part1/setup.adoc[]
+
+include::part1/mapping.adoc[]
+
+include::part1/modeler.adoc[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/mapping.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/mapping.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/mapping.adoc
new file mode 100644
index 0000000..2180fed
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/mapping.adoc
@@ -0,0 +1,70 @@
+// 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.
+
+=== Cayenne Mapping Structure
+
+==== Cayenne Project
+
+A Cayenne project is an XML representation of a model connecting database schema with Java classes. A project is normally created and manipulated via CayenneModeler GUI and then used to initialize Cayenne runtime. A project is made of one or more files. There's always a root project descriptor file in any valid project. It is normally called `cayenne-xyz.xml`, where "xyz" is the name of the project.
+
+Project descriptor can reference DataMap files, one per DataMap. DataMap files are normally called `xyz.map.xml`, where "xyz" is the name of the DataMap. For legacy reasons this naming convention is different from the convention for the root project descriptor above, and we may align it in the future versions. Here is how a typical project might look on the file system:
+
+----
+~: ls -l
+total 24
+-rw-r--r--  1 cayenne  staff  491 Jan 28 18:25 cayenne-project.xml
+-rw-r--r--  1 cayenne  staff  313 Jan 28 18:25 datamap.map.xml
+----
+
+DataMap are referenced by name in the root descriptor:
+
+[source,xml]
+----
+<map name="datamap"/>
+----
+
+Map files are resolved by Cayenne by appending ".map.xml" extension to the map name, and resolving the resulting string relative to the root descriptor URI. The following sections discuss varios ORM model objects, without regards to their XML representation. XML format details are really unimportant to the Cayenne users.
+
+==== DataMap
+
+DataMap is a container of persistent entities and other object-relational metadata. DataMap provides developers with a scope to organize their entities, but it does not provide a namespace for entities. In fact all DataMaps present in runtime are combined in a single namespace. Each DataMap must be associated with a DataNode. This is how Cayenne knows which database to use when running a query.
+
+==== DataNode
+
+DataNode is model of a database. It is actually pretty simple. It has an arbitrary user-provided name and information needed to create or locate a JDBC DataSource. Most projects only have one DataNode, though there may be any number of nodes if needed.
+
+==== DbEntity
+
+DbEntity is a model of a single DB table or view. DbEntity is made of DbAttributes that correspond to columns, and DbRelationships that map PK/FK pairs. DbRelationships are not strictly tied to FK constraints in DB, and should be mapped for all logical "relationships" between the tables.
+
+==== ObjEntity
+
+ObjEntity is a model of a single persistent Java class. ObjEntity is made of ObjAttributes and ObjRelationships. Both correspond to entity class properties. However ObjAttributes represent "simple" properties (normally things like String, numbers, dates, etc.), while ObjRelationships correspond to properties that have a type of another entity.
+
+ObjEntity maps to one or more DbEntities. There's always one "root" DbEntity for each ObjEntity. ObjAttribiute maps to a DbAttribute or an Embeddable. Most often mapped DbAttribute is from the root DbEntity. Sometimes mapping is done to a DbAttribute from another DbEntity somehow related to the root DbEntity. Such ObjAttribute is called "flattened". Similarly ObjRelationship maps either to a single DbRelationship, or to a chain of DbRelationships ("flattened" ObjRelationship).
+
+ObjEntities may also contain mapping of their lifecycle callback methods.
+
+==== Embeddable
+
+Embeddable is a model of a Java class that acts as a single attribute of an ObjEntity, but maps to multiple columns in the database.
+
+==== Procedure
+
+A model of a stored procedure in the database.
+
+==== Query
+
+A model of a query. Cayenne allows queries to be mapped in Cayenne project, or created in the code. Depending on the circumstances the users may take one or the other approach.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/modeler.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/modeler.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/modeler.adoc
new file mode 100644
index 0000000..8afc6ae
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/modeler.adoc
@@ -0,0 +1,42 @@
+// 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.
+
+=== CayenneModeler Application
+
+==== Working with Mapping Projects
+
+==== Reverse Engineering Database
+
+
+
+==== Generating Database Schema
+
+
+==== Migrations
+
+==== Generating Java Classes
+
+==== Modeling Inheritance
+
+==== Modeling Generic Persistent Classes
+
+Normally each ObjEntity is mapped to a specific Java class (such as Artist or Painting) that explicitly declare all entity properties as pairs of getters and setters. However Cayenne allows to map a completly generic class to any number of entities. The only expectation is that a generic class implements org.apache.cayenne.DataObject. So an ideal candidate for a generic class is CayenneDataObject, or some custom subclass of CayenneDataObject.
+
+If you don't enter anything for Java Class of an ObjEntity, Cayenne assumes generic mapping and uses the following implicit rules to determine a class of a generic object. If DataMap "Custom Superclass" is set, runtime uses this class to instantiate new objects. If not, `org.apache.cayenne.CayenneDataObject` is used.
+
+Class generation procedures (either done in the Modeler or with Ant or Maven) would skip entities that are mapped to CayenneDataObject explicitly or have no class mapping.
+
+==== Mapping ObjAttributes to Custom Classes
+
+==== Modeling Primary Key Generation Strategy
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/setup.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/setup.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/setup.adoc
new file mode 100644
index 0000000..0e93de2
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part1/setup.adoc
@@ -0,0 +1,58 @@
+// 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.
+
+include::../var.adoc[]
+
+=== Setup
+
+==== System Requirements
+
+- Java: Cayenne runtime framework and CayenneModeler GUI tool are written in 100% Java, and run on any Java-compatible platform. Required JDK version is 1.5 or higher. The last version of Cayenne compatible with JDK 1.4 is 1.2.x/2.0.x and JDK 1.3 is 1.1.x
+
+- JDBC Driver: An appropriate DB-specific JDBC driver is needed to access the database. It can be included in the application or used in web container DataSource configuration.
+
+- Third-party Libraries: Cayenne runtime framework has a minimal set of required and a few more optional dependencies on third-party open source packages. See "Including Cayenne in a Project" chapter for details.
+
+[[runModeler]]
+==== Running CayenneModeler
+
+CayenneModeler GUI tool is intended to work with object relational mapping projects. While you can edit your XML by hand, it is rarely needed, as the Modeler is a pretty advanced tool included in Cayenne distribution. To obtain CayenneModeler, download Cayenne distribution archive from http://cayenne.apache.org/download.html matching the OS you are using. Of course Java needs to be installed on the machine where you are going to run the Modeler.
+
+- OS X distribution contains CayenneModeler.app at the root of the distribution disk image.
+- Windows distribution contains CayenneModeler.exe file in the bin directory.
+- Cross-platform distribution (targeting Linux, but as the name implies, compatible with any OS) contains a runnable CayenneModeler.jar in the bin directory. It can be executed either by double-clicking, or if the environment is not configured to execute jars, by running from command-line:
+
+----
+$ java -jar CayenneModeler.jar
+----
+
+The Modeler can also be started from Maven. While it may look like an exotic way to start a GUI application, it has its benefits - no need to download Cayenne distribution, the version of the Modeler always matches the version of the framework, the plugin can find mapping files in the project automatically. So it is an attractive option to some developers. Maven option requires a declaration in the POM:
+[source,xml,subs="verbatim,attributes"]
+----
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.apache.cayenne.plugins</groupId>
+            <artifactId>maven-cayenne-modeler-plugin</artifactId>
+            <version>{version}</version>
+        </plugin>
+    </plugins>
+</build>
+----
+
+And then can be run as
+
+----
+$ mvn cayenne-modeler:run
+----

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2.adoc
new file mode 100644
index 0000000..505a029
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2.adoc
@@ -0,0 +1,33 @@
+// 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.
+
+== Cayenne Framework
+
+include::part2/including.adoc[]
+
+include::part2/starting.adoc[]
+
+include::part2/objectContext.adoc[]
+
+include::part2/expressions.adoc[]
+
+include::part2/orderings.adoc[]
+
+include::part2/queries.adoc[]
+
+include::part2/lifecycle.adoc[]
+
+include::part2/tuning.adoc[]
+
+include::part2/customize.adoc[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
new file mode 100644
index 0000000..919a697
--- /dev/null
+++ b/docs/asciidoc/cayenne-guide/src/docs/asciidoc/_cayenne-guide/part2/customize.adoc
@@ -0,0 +1,288 @@
+// 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.
+
+[[customize]]
+=== Customizing Cayenne Runtime
+
+==== Dependency Injection Container
+
+Cayenne runtime is built around a small powerful dependency injection (DI) container. Just like other popular DI technologies, such as Spring or Guice, Cayenne DI container manages sets of interdependent objects and allows users to configure them. These objects are regular Java objects. We are calling them "services" in this document to distinguish from all other objects that are not configured in the container and are not managed. DI container is responsible for service instantiation, injecting correct dependencies, maintaining service instances scope, and dispatching scope events to services.
+
+The services are configured in special Java classes called "modules". Each module defines binding of service interfaces to implementation instances, implementation types or providers of implementation instances. There are no XML configuration files, and all the bindings are type-safe. The container supports injection into instance variables and constructor parameters based on the `@Inject` annotation. This mechanism is very close to Google Guice.
+
+The discussion later in this chapter demonstrates a standalone DI container. But keep in mind that Cayenne already has a built-in Injector, and a set of default modules. A Cayenne user would normally only use the API below to write custom extension modules that will be loaded in that existing container when creating ServerRuntime. See "Starting and Stopping ServerRuntime" chapter for an example of passing an extension module to Cayenne.
+
+Cayenne DI probably has ~80% of the features expected in a DI container and has no dependency on the rest of Cayenne, so in theory can be used as an application-wide DI engine. But it's primary purpose is still to serve Cayenne. Hence there are no plans to expand it beyond Cayenne needs. It is an ideal "embedded" DI that does not interfere with Spring, Guice or any other such framework present elsewhere in the application.
+
+===== DI Bindings API
+
+To have a working DI container, we need three things: service interfaces and classes, a module that describes service bindings, a container that loads the module, and resolves the depedencies. Let's start with service interfaces and classes:
+
+[source, Java]
+----
+public interface Service1 {
+    public String getString();
+}
+----
+
+[source, Java]
+----
+public interface Service2 {
+    public int getInt();
+}
+----
+
+A service implementation using instance variable injection:
+
+[source, Java]
+----
+public class Service1Impl implements Service1 {
+    @Inject
+    private Service2 service2;
+
+    public String getString() {
+        return service2.getInt() + "_Service1Impl";
+    }
+}
+----
+
+Same thing, but using constructor injection:
+
+[source, Java]
+----
+public class Service1Impl implements Service1 {
+
+    private Service2 service2;
+
+    public Service1Impl(@Inject Service2 service2) {
+        this.service2 = service2;
+    }
+
+    public String getString() {
+        return service2.getInt() + "_Service1Impl";
+    }
+}
+----
+
+[source, Java]
+----
+public class Service2Impl implements Service2 {
+    private int i;
+
+    public int getInt() {
+        return i++;
+    }
+}
+----
+
+Now let's create a module implementing `org.apache.cayenne.tutorial.di.Module` interface that will contain DI configuration. A module binds service objects to keys that are reference. Binder provided by container implements fluent API to connect the key to implementation, and to configure various binding options (the options, such as scope, are demonstrated later in this chapter). The simplest form of a key is a Java Class object representing service interface. Here is a module that binds Service1 and Service2 to corresponding default implementations:
+
+[source, Java]
+----
+public class Module1 implements Module {
+
+    public void configure(Binder binder) {
+        binder.bind(Service1.class).to(Service1Impl.class);
+        binder.bind(Service2.class).to(Service2Impl.class);
+    }
+}
+----
+
+Once we have at least one module, we can create a DI container. `org.apache.cayenne.di.Injector` is the container class in Cayenne:
+
+[source, Java]
+----
+Injector injector = DIBootstrap.createInjector(new Module1());
+----
+
+Now that we have created the container, we can obtain services from it and call their methods:
+
+[source, Java]
+----
+Service1 s1 = injector.getInstance(Service1.class);
+for (int i = 0; i < 5; i++) {
+    System.out.println("S1 String: " + s1.getString());
+}
+----
+
+This outputs the following lines, demonstrating that s1 was Service1Impl and Service2 injected into it was Service2Impl:
+
+[source]
+----
+0_Service1Impl
+1_Service1Impl
+2_Service1Impl
+3_Service1Impl
+4_Service1Impl
+----
+
+There are more flavors of bindings:
+
+[source, Java]
+----
+// binding to instance - allowing user to create and configure instance
+// inside the module class
+binder.bind(Service2.class).toInstance(new Service2Impl());
+
+// binding to provider - delegating instance creation to a special
+// provider class
+binder.bind(Service1.class).toProvider(Service1Provider.class);
+
+// binding to provider instance
+binder.bind(Service1.class).toProviderInstance(new Service1Provider());
+
+// multiple bindings of the same type using Key
+// injection can reference the key name in annotation:
+// @Inject("i1")
+// private Service2 service2;
+binder.bind(Key.get(Service2.class, "i1")).to(Service2Impl.class);
+binder.bind(Key.get(Service2.class, "i2")).to(Service2Impl.class);
+----
+
+
+Another types of confiuguration that can be bound in the container are lists and maps. They will be discussed in the following chapters.
+
+===== Service Lifecycle
+
+An important feature of the Cayenne DI container is instance scope. The default scope (implicitly used in all examples above) is "singleton", meaning that a binding would result in creation of only one service instance, that will be repeatedly returned from `Injector.getInstance(..)`, as well as injected into classes that declare it as a dependency.
+
+Singleton scope dispatches a "BeforeScopeEnd" event to interested services. This event occurs before the scope is shutdown, i.e. when `Injector.shutdown()` is called. Note that the built-in Cayenne injector is shutdown behind the scenes when `ServerRuntime.shutdown()` is invoked. Services may register as listeners for this event by annotating a no-argument method with `@BeforeScopeEnd` annotation. Such method should be implemented if a service needs to clean up some resources, stop threads, etc.
+
+Another useful scope is "no scope", meaning that every time a container is asked to provide a service instance for a given key, a new instance will be created and returned:
+
+[source, Java]
+----
+binder.bind(Service2.class).to(Service2Impl.class).withoutScope();
+----
+
+Users can also create their own scopes, e.g. a web application request scope or a session scope. Most often than not custom scopes can be created as instances of `org.apache.cayenne.di.spi.DefaultScope` with startup and shutdown managed by the application (e.g. singleton scope is a DefaultScope managed by the Injector) .
+
+===== Overriding Services
+
+Cayenne DI allows to override services already definied in the current module, or more commonly - some other module in the the same container. Actually there's no special API to override a service, you'd just bind the service key again with a new implementation or provider. The last binding for a key takes precedence. This means that the order of modules is important when configuring a container. The built-in Cayenne injector ensures that Cayenne standard modules are loaded first, followed by optional user extension modules. This way the application can override the standard services in Cayenne.
+
+==== Customization Strategies
+
+The previous section discussed how Cayenne DI works in general terms. Since Cayenne users will mostly be dealing with an existing Injector provided by ServerRuntime, it is important to understand how to build custom extensions to a preconfigured container. As shown in "Starting and Stopping ServerRuntime" chapter, custom extensions are done by writing an aplication DI module (or multiple modules) that configures service overrides. This section shows all the configuration possibilities in detail, including changing properties of the existing services, contributing services to standard service lists and maps, and overriding service implementations. All the code examples later in this section are assumed to be placed in an application module "configure" method:
+
+[source, Java]
+----
+public class MyExtensionsModule implements Module {
+    public void configure(Binder binder) {
+        // customizations go here...
+    }
+}
+----
+
+[source, Java]
+----
+Module extensions = new MyExtensionsModule();
+ServerRuntime runtime =
+    new ServerRuntime("com/example/cayenne-mydomain.xml", extensions);
+----
+
+===== Changing Properties of Existing Services
+
+Many built-in Cayenne services change their behavior based on a value of some environment property. A user may change Cayenne behavior without even knowing which services are responsible for it, but setting a specific value of a known property. Supported property names are listed in "Appendix A".
+
+There are two ways to set service properties. The most obvious one is to pass it to the JVM with -D flag on startup. E.g.
+
+----
+$ java -Dcayenne.server.contexts_sync_strategy=false ...
+----
+
+A second one is to contribute a property to `org.apache.cayenne.configuration.DefaultRuntimeProperties.properties` map (see the next section on how to do that). This map contains the default property values and can accept application-specific values, overrding the defaults.
+
+Note that if a property value is a name of a Java class, when this Java class is instantiated by Cayenne, the container performs injection of instance variables. So even the dynamically specified Java classes can use @Inject annotation to get a hold of other Cayenne services.
+
+If the same property is specified both in the command line and in the properties map, the command-line value takes precedence. The map value will be ignored. This way Cayenne runtime can be reconfigured during deployment.
+
+===== Contributing to Service Collections
+
+Cayenne can be extended by adding custom objects to named maps or lists bound in DI. We are calling these lists/maps "service collections". A service collection allows things like appending a custom strategy to a list of built-in strategies. E.g. an application that needs to install a custom DbAdapter for some database type may contribute an instance of custom DbAdapterDetector to a `org.apache.cayenne.configuration.server.DefaultDbAdapterFactory.detectors` list:
+
+[source, Java]
+----
+public class MyDbAdapterDetector implements DbAdapterDetector {
+    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {
+        // check if we support this database and retun custom adapter
+        ...
+    }
+}
+----
+
+[source, Java]
+----
+// since build-in list for this key is a singleton, repeated
+// calls to 'bindList' will return the same instance
+binder.bindList(DefaultDbAdapterFactory.DETECTORS_LIST)
+       .add(MyDbAdapterDetector.class);
+----
+
+Maps are customized using a similar `"bindMap"` method.
+
+The names of built-in collections are listed in "Appendix B".
+
+===== Alternative Service Implementations
+
+As mentioned above, custom modules are loaded by ServerRuntime after the built-in modules. So it is easy to redefine a built-in service in Cayenne by rebinding desired implementations or providers. To do that, first we need to know what those services to redefine are. While we describe some of them in the following sections, the best way to get a full list is to check the source code of the Cayenne version you are using and namely look in `org.apache.cayenne.configuration.server.ServerModule` - the main built-in module in Cayenne.
+
+Now an example of overriding `QueryCache` service. The default implementation of this service is provided by `MapQueryCacheProvider`. But if we want to use `EhCacheQueryCache` (a Cayenne wrapper for the EhCache framework), we can define it like this:
+
+[source, Java]
+----
+binder.bind(QueryCache.class).to(EhCacheQueryCache.class);
+----
+
+==== Noteworthy Built-in Services
+
+===== JdbcEventLogger
+
+`org.apache.cayenne.log.JdbcEventLogger` is the service that defines logging API for Cayenne internals. It provides facilities for logging queries, commits, transactions, etc. The default implementation is `org.apache.cayenne.log.Slf4jJdbcEventLogger` that performs logging via slf4j-api library. Cayenne library includes another potentially useful logger - `org.apache.cayenne.log.FormattedSlf4jJdbcEventLogger` that produces formatted multiline SQL output that can be easier to read.
+
+===== DataSourceFactory
+
+===== DataChannelFilter
+
+===== QueryCache
+
+===== ExtebdedTypes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


[07/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc
new file mode 100644
index 0000000..0a9ef94
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/adding.adoc
@@ -0,0 +1,129 @@
+// 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.
+
+=== Adding BASIC Authentication
+
+You probably don't want everybody in the world to connect to your service and access (and update!) arbitrary data in the database. The first step in securing Cayenne service is implementing client authentication. The easiest way to do it is to delegate the authentication task to the web container that is running the service. HessianConnection used in the previous chapter supports BASIC authentication on the client side, so we'll demonstrate how to set it up here.
+
+==== Securing ROP Server Application
+
+Open web.xml file in the server project and setup security constraints with BASIC authentication for the ROP service:
+
+[source, XML]
+----
+<security-constraint>
+    <web-resource-collection>
+        <web-resource-name>CayenneService</web-resource-name>
+        <url-pattern>/cayenne-service</url-pattern>
+    </web-resource-collection>
+    <auth-constraint>
+        <role-name>cayenne-service-user</role-name>
+    </auth-constraint>
+</security-constraint>
+
+<login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>Cayenne Realm</realm-name>
+</login-config>
+
+<security-role>
+    <role-name>cayenne-service-user</role-name>
+</security-role>
+----
+
+==== Configuring Jetty for BASIC Authentication
+
+NOTE: These instructions are specific to Jetty 6. Other containers (and versions of Jetty) will have different mechansims to achieve the same thing.
+
+Open pom.xml in the server project and configure a "userRealm" for the Jetty plugin:
+
+[source, XML]
+----
+<plugin>
+    <groupId>org.mortbay.jetty</groupId>
+        <artifactId>maven-jetty-plugin</artifactId>
+        <version>6.1.22</version>
+        <!-- adding configuration below: -->
+        <configuration>
+            <userRealms>
+                <userRealm implementation="org.mortbay.jetty.security.HashUserRealm">
+                    <!-- this name must match the realm-name in web.xml -->
+                    <name>Cayenne Realm</name>
+                    <config>realm.properties</config>
+                </userRealm>
+            </userRealms>
+        </configuration>
+    </plugin>
+</plugins>
+----
+
+Now create a new file called {["realm.properties"}} at the root of the server project and put user login/password in there:
+
+[source]
+----
+cayenne-user: secret,cayenne-service-user
+----
+
+Now let's stop the server and start it again. Everything should start as before, but if you go to http://localhost:8080/tutorial/cayenne-service, your browser should pop up authentication dialog. Enter "cayenne-user/secret" for user name / password, and you should see "Hessian Requires POST" message. So the server is now secured.
+
+==== Running Client with Basic Authentication
+
+If you run the client without any changes, you'll get the following error:
+
+[source]
+----
+org.apache.cayenne.remote.hessian.HessianConnection connect
+INFO: Connecting to [http://localhost:8080/tutorial/cayenne-service] - dedicated session.
+org.apache.cayenne.remote.hessian.HessianConnection connect
+INFO: Error establishing remote session. URL - http://localhost:8080/tutorial/cayenne-service;
+      CAUSE - cannot retry due to server authentication, in streaming mode
+java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
+    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1257)
+    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
+    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:168)
+    at $Proxy0.establishSession(Unknown Source)
+    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:210)
+    at org.apache.cayenne.remote.hessian.HessianConnection.getServerEventBridge(HessianConnection.java:114)
+    at org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:337)
+    at org.apache.cayenne.remote.ClientChannel.<init>(ClientChannel.java:108)
+    at org.example.cayenne.Main.main(Main.java:25)
+Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.3.1M3 Sep 19 2011 07:12:41]
+Error establishing remote session. URL - http://localhost:8080/tutorial/cayenne-service;
+CAUSE - cannot retry due to server authentication, in streaming mode
+    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:229)
+    at org.apache.cayenne.remote.hessian.HessianConnection.getServerEventBridge(HessianConnection.java:114)
+    at org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:337)
+    at org.apache.cayenne.remote.ClientChannel.<init>(ClientChannel.java:108)
+    at org.example.cayenne.Main.main(Main.java:25)
+Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode
+    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1257)
+    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
+    at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:168)
+    at $Proxy0.establishSession(Unknown Source)
+    at org.apache.cayenne.remote.hessian.HessianConnection.connect(HessianConnection.java:210)
+    ... 4 more
+----
+
+Which is exactly what you'd expect, as the client is not authenticating itself. So change the line in Main.java where we obtained an ROP connection to this:
+
+[source, java]
+----
+ClientConnection connection = new HessianConnection(
+        "http://localhost:8080/tutorial/cayenne-service",
+        "cayenne-user", "secret", null);
+----
+
+Try running again, and everything should work as before. Obviously in production environment, in addition to authentication you'll need to use HTTPS to access the server to prevent third-party eavesdropping on your password and data.
+
+Congratulations, you are done with the ROP tutorial!

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc
new file mode 100644
index 0000000..14e4263
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/connect.adoc
@@ -0,0 +1,176 @@
+// 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.
+
+=== Porting Existing Code to Connect to a Web Service Instead of a Database
+
+==== Starting Command Line Client
+
+One of the benefits of ROP is that the client code is no different from the server code - it uses the same ObjectContext interface for access, same query and commit API. So the code below will be similar to the code presented in the first Cayenne Getting Started Guide, although with a few ROP-specific parts required to bootstrap the ObjectContext.
+
+Let's start by creating an empty Main class with the standard main() method in the client project:
+
+[source, java]
+----
+package org.example.cayenne.persistent.client;
+
+public class Main {
+
+    public static void main(String[] args) {
+
+    }
+}
+----
+
+Now the part that is actually different from regular Cayenne - establishing the server connection and obtaining the ObjectContext:
+
+[source, java]
+----
+ClientConnection connection = new HessianConnection("http://localhost:8080/tutorial/cayenne-service");
+DataChannel channel = new ClientChannel(connection, false, new DefaultEventManager(), false);
+ObjectContext context = new CayenneContext(channel);
+----
+
+Note that the "channel" can be used to create as many peer ObjectContexts as needed over the same connection, while ObjectContext is a kind of isolated "persistence session", similar to the server-side context. A few more notes. Since we are using HTTP(S) to communicate with ROP server, there's no need to explicitly close the connection (or channel, or context).
+
+So now let's do the same persistent operaions that we did in the first tutorial "Main" class. Let's start by creating and saving some objects:
+
+[source, java]
+----
+// creating new Artist
+Artist picasso = context.newObject(Artist.class);
+picasso.setName("Pablo Picasso");
+
+// Creating other objects
+Gallery metropolitan = context.newObject(Gallery.class);
+metropolitan.setName("Metropolitan Museum of Art");
+
+Painting girl = context.newObject(Painting.class);
+girl.setName("Girl Reading at a Table");
+
+Painting stein = context.newObject(Painting.class);
+stein.setName("Gertrude Stein");
+
+// connecting objects together via relationships
+picasso.addToPaintings(girl);
+picasso.addToPaintings(stein);
+
+girl.setGallery(metropolitan);
+stein.setGallery(metropolitan);
+
+// saving all the changes above
+context.commitChanges();
+----
+
+Now let's select them back:
+
+[source, java]
+----
+// SelectQuery examples
+SelectQuery select1 = new SelectQuery(Painting.class);
+List<Painting> paintings1 = context.performQuery(select1);
+
+Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
+        Painting.NAME_PROPERTY, "gi%");
+SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
+List<Painting> paintings2 = context.performQuery(select2);
+----
+
+Now, delete:
+
+[source, java]
+----
+Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY,
+                "Pablo Picasso");
+SelectQuery selectToDelete = new SelectQuery(Artist.class, qualifier);
+Artist picasso = (Artist) DataObjectUtils.objectForQuery(context,
+        selectToDelete);
+
+if (picasso != null) {
+    context.deleteObject(picasso);
+    context.commitChanges();
+}
+----
+
+This code is exactly the same as in the first tutorial. So now let's try running the client and see what happens. In Eclipse open main class and select "Run > Run As > Java Application" from the menu (assuming the ROP server started in the previous step is still running). You will some output in both server and client process consoles. Client:
+
+[source]
+----
+INFO: Connecting to [http://localhost:8080/tutorial/cayenne-service] - dedicated session.
+INFO: === Connected, session: org.apache.cayenne.remote.RemoteSession@26544ec1[sessionId=17uub1h34r9x1] - took 111 ms.
+INFO: --- Message 0: Bootstrap
+INFO: === Message 0: Bootstrap done - took 58 ms.
+INFO: --- Message 1: flush-cascade-sync
+INFO: === Message 1: flush-cascade-sync done - took 1119 ms.
+INFO: --- Message 2: Query
+INFO: === Message 2: Query done - took 48 ms.
+INFO: --- Message 3: Query
+INFO: === Message 3: Query done - took 63 ms.
+INFO: --- Message 4: Query
+INFO: === Message 4: Query done - took 19 ms.
+INFO: --- Message 5: Query
+INFO: === Message 5: Query done - took 7 ms.
+INFO: --- Message 6: Query
+INFO: === Message 6: Query done - took 5 ms.
+INFO: --- Message 7: Query
+INFO: === Message 7: Query done - took 2 ms.
+INFO: --- Message 8: Query
+INFO: === Message 8: Query done - took 4 ms.
+INFO: --- Message 9: flush-cascade-sync
+INFO: === Message 9: flush-cascade-sync done - took 34 ms.
+----
+
+As you see client prints no SQL statmenets, just a bunch of query and flush messages sent to the server. The server side is more verbose, showing the actual client queries executed against the database:
+
+[source]
+----
+...
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
+INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
+INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+INFO: [batch bind: 1->DATE_OF_BIRTH:NULL, 2->ID:200, 3->NAME:'Pablo Picasso']
+INFO: === updated 1 row.
+INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
+INFO: [batch bind: 1->ID:200, 2->NAME:'Metropolitan Museum of Art']
+INFO: === updated 1 row.
+INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200, 4->NAME:'Girl Reading at a Table']
+INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201, 4->NAME:'Gertrude Stein']
+INFO: === updated 2 rows.
+INFO: +++ transaction committed.
+INFO: --- transaction started.
+INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0
+INFO: === returned 2 rows. - took 14 ms.
+INFO: +++ transaction committed.
+INFO: --- transaction started.
+INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0
+      WHERE UPPER(t0.NAME) LIKE UPPER(?) [bind: 1->NAME:'gi%']
+INFO: === returned 1 row. - took 10 ms.
+INFO: +++ transaction committed.
+INFO: --- transaction started.
+INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME = ? [bind: 1->NAME:'Pablo Picasso']
+INFO: === returned 1 row. - took 8 ms.
+INFO: +++ transaction committed.
+INFO: --- transaction started.
+INFO: DELETE FROM PAINTING WHERE ID = ?
+INFO: [batch bind: 1->ID:200]
+INFO: [batch bind: 1->ID:201]
+INFO: === updated 2 rows.
+INFO: DELETE FROM ARTIST WHERE ID = ?
+INFO: [batch bind: 1->ID:200]
+INFO: === updated 1 row.
+INFO: +++ transaction committed.
+----
+
+You are done with the basic ROP client!
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/hessianWebServ.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/hessianWebServ.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/hessianWebServ.adoc
new file mode 100644
index 0000000..cf140ec
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/hessianWebServ.adoc
@@ -0,0 +1,113 @@
+// 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.
+
+===  Setting up Hessian Web Service
+
+==== Setting up Dependencies
+
+Now lets get back to the "tutorial" project that contains a web application and set up dependencies. The only extra one that we don't have yet is resin-hessian.jar, just like the client, so let's add it (and the caucho repo declaration) to the pom.xml.
+
+[source, XML]
+----
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    ...
+    <dependencies>
+        ...
+        <dependency>
+            <groupId>com.caucho</groupId>
+            <artifactId>resin-hessian</artifactId>
+            <version>3.1.6</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+    ...
+    </build>
+
+    <repositories>
+        <repository>
+            <id>caucho</id>
+            <name>Caucho Repository</name>
+            <url>http://caucho.com/m2</url>
+            <layout>default</layout>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+        </repository>
+    </repositories>
+    </project>
+----
+
+NOTE: *Maven Optimization Hint* On a real project both server and client modules will likely share a common parent pom.xml where common repository delcaration can be placed, with child pom's "inheriting" it from parent. This would reduce build code duplication.
+
+==== Client Classes on the Server
+
+Since ROP web service requires both server and client persistent classes, we need to generate a second copy of the client classes inside the server project. This is a minor inconvenience that will hopefully go away in the future versions of Cayenne. Don't forget to refresh the project in Eclipse after class generation is done.
+
+==== Configuring web.xml
+
+Cayenne web service is declared in the web.xml. It is implemented as a servlet "org.apache.cayenne.rop.ROPServlet". Open tutorial/src/main/webapp/WEB-INF/web.xml in Eclipse and add a service declaration:
+
+[source, XML]
+----
+<?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE web-app
+   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+   "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+    <display-name>Cayenne Tutorial</display-name>
+    <servlet>
+        <servlet-name>cayenne-project</servlet-name>
+        <servlet-class>org.apache.cayenne.configuration.rop.server.ROPHessianServlet</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>cayenne-project</servlet-name>
+        <url-pattern>/cayenne-service</url-pattern>
+    </servlet-mapping>
+    </web-app>
+----
+
+NOTE: *Extending Server Behavior via Callbacks* While no custom Java code is required on the server, just a service declaration, it is possible to customizing server-side behavior via callbacks and listeners (not shown in the tutorial).
+
+==== Running ROP Server
+
+Use previosly created Eclipse Jetty run configuration available via "Run > Run Configurations..." (or create a new one if none exists yet). You should see output in the Eclipse console similar to the following:
+
+[source]
+----
+[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building tutorial 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+...
+[INFO] Starting jetty 6.1.22 ...
+INFO::jetty-6.1.22
+INFO::No Transaction manager found - if your webapp requires one, please configure one.
+INFO::Started SelectChannelConnector@0.0.0.0:8080
+[INFO] Started Jetty Server
+INFO: Loading XML configuration resource from file:cayenne-project.xml
+INFO: loading user name and password.
+INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+    Driver class: org.apache.derby.jdbc.EmbeddedDriver
+    Min. connections in the pool: 1
+    Max. connections in the pool: 1
+----
+
+Cayenne ROP service URL is http://localhost:8080/tutorial/cayenne-service. If you click on it, you will see "Hessian Requires POST" message, that means that the service is alive, but you need a client other than the web browser to access it.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc
new file mode 100644
index 0000000..47638dc
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2/starting.adoc
@@ -0,0 +1,93 @@
+// 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.
+
+include::../var.adoc[]
+
+=== Starting Client Project
+
+==== Create an ROP Client Project in Eclipse
+
+Creation of a new Eclipse project has been discussed in some details in "Getting Started with Cayenne" guide, so we will omit the screenshots for the common parts.
+
+In Eclipse select "File > New > Other..." and then "Maven > Maven Project". Click "Next". On the following screen check "Create a simple project" checkbox and click "Next" again. In the dialog shown on the screenshot below, enter "org.example.cayenne" for the "Group Id" and "tutorial-rop-client" for the "Artifact Id" (both without the quotes) and click "Finish".
+
+Now you should have a new empty project in the Eclipse workspace. Check that the project Java compiler settings are correct. Rightclick on the "tutorial-rop-client" project, select "Properties > Java Compiler" and ensure that "Compiler compliance level" is at least 1.5 (some versions of Maven plugin seem to be setting it to 1.4 by default).
+
+==== Create Client Java Classes
+
+The client doesn't need the XML ORM mapping, as it is loaded from the server. However it needs the client-side Java classes. Let's generate them from the existing mapping:
+
+* Start CayenneModeler and open cayenne.xml from the "tutorial" project (located under "tutorial/src/main/resources", unless it is already open.
+
+* Select the "datamap" DataMap and check "Allow Client Entities" checkbox.
+
+* Enter "org.example.cayenne.persistent.client" for the "Client Java Package" and click "Update.." button next to the field to refresh the client package of all entities.
+
+image::../images/datamap-enableclient.png[align="center"]
+
+* Select "Tools > Generate Classes" menu.
+
+* For "Type" select "Client Persistent Objects".
+
+* For the "Output Directory" select "tutorial-rop-client/src/main/java" folder (as client classes should go in the client project).
+
+* Click on "Classes" tab and check the "Check All Classes" checkbox (unless it is already checked and reads "Uncheck all Classes").
+
+* Click "Generate".
+
+Now go back to Eclipse, right click on "tutorial-rop-client" project and select "Refresh" - you should see pairs of classes generated for each mapped entity, same as on the server. And again, we see a bunch of errors in those classes. Let's fix it now by adding two dependencies, "cayenne-client" and "resin-hessian", in the bottom of the pom.xml file. We also need to add Caucho M2 repository to pull Hessian jar files. The resulting POM should look like this:
+
+[source, XML,subs="verbatim,attributes"]
+----
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.example.cayenne</groupId>
+    <artifactId>tutorial-rop-client</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-client</artifactId>
+            <!-- Here specify the version of Cayenne you are actually using -->
+            <version>{version}</version>
+        </dependency>
+        <dependency>
+        <groupId>com.caucho</groupId>
+            <artifactId>resin-hessian</artifactId>
+            <version>3.1.6</version>
+        </dependency>
+    </dependencies>
+
+   <repositories>
+           <repository>
+               <id>caucho</id>
+               <name>Caucho Repository</name>
+               <url>http://caucho.com/m2</url>
+               <layout>default</layout>
+               <snapshots>
+                   <enabled>false</enabled>
+               </snapshots>
+               <releases>
+                   <enabled>true</enabled>
+               </releases>
+           </repository>
+       </repositories>
+</project>
+----
+
+Your computer must be connected to the internet. Once you save the pom.xml, Eclipse will download the needed jar files and add them to the project build path. After that all the errors should disappear.
+
+Now let's check the entity class pairs. They look almost identical to their server counterparts, although the superclass and the property access code are different. At this point these differences are somewhat academic, so let's go on with the tutorial.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/var.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/var.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/var.adoc
new file mode 100644
index 0000000..e575eda
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/var.adoc
@@ -0,0 +1 @@
+:version: {project-version}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/getting-started-rop.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/getting-started-rop.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/getting-started-rop.adoc
new file mode 100644
index 0000000..9362783
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/getting-started-rop.adoc
@@ -0,0 +1,45 @@
+// 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.
+= Getting Started with Cayenne ROP (Remote Object Persistence)
+:revnumber: {project-major-version} ({project-version})
+// enable section numbering, limiting depth to 2
+:sectnums:
+:sectnumlevels: 2
+// use custom header
+:cayenne-header: _getting_started_rop/header.html
+:cayenne-header-position: body
+// customize final layout
+//:linkcss:
+// base path to java code include
+:cayenne-root: {basedir}/../../..
+
+[small]#Copyright © 2011-2017 Apache Software Foundation and individual authors#
+
+.License
+[small]#_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_#
+
+[small]#_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._#
+
+include::_getting-started-rop/part1.adoc[]
+
+include::_getting-started-rop/part2.adoc[]
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/images/datamap-enableclient.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/images/datamap-enableclient.png b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/images/datamap-enableclient.png
new file mode 100644
index 0000000..62a2af2
Binary files /dev/null and b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/images/datamap-enableclient.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/pom.xml b/docs/asciidoc/pom.xml
new file mode 100644
index 0000000..81b0660
--- /dev/null
+++ b/docs/asciidoc/pom.xml
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.parents</groupId>
+        <artifactId>cayenne-docs-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>cayenne-asciidoc-parent</artifactId>
+    <groupId>org.apache.cayenne.docs</groupId>
+    <name>cayenne-asciidoc: Cayenne AsciiDoc Documentation parent</name>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>cayenne-asciidoc-extension</module>
+        <module>getting-started-guide</module>
+        <module>cayenne-guide</module>
+        <module>getting-started-rop</module>
+        <module>upgrade-guide</module>
+    </modules>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <asciidoctorj.version>1.5.6</asciidoctorj.version>
+        <asciidoctor.maven.plugin.version>1.5.6</asciidoctor.maven.plugin.version>
+        <asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
+        <jruby.version>1.7.26</jruby.version>
+        <cayenne.major.version>3.1</cayenne.major.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-server</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.asciidoctor</groupId>
+            <artifactId>asciidoctorj</artifactId>
+            <version>${asciidoctorj.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.asciidoctor</groupId>
+                    <artifactId>asciidoctor-maven-plugin</artifactId>
+                    <version>${asciidoctor.maven.plugin.version}</version>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.asciidoctor</groupId>
+                            <artifactId>asciidoctorj-pdf</artifactId>
+                            <version>${asciidoctorj.pdf.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+        <plugins>
+            <plugin>
+                <groupId>org.asciidoctor</groupId>
+                <artifactId>asciidoctor-maven-plugin</artifactId>
+                <configuration>
+                    <sourceDirectory>src/docs/asciidoc</sourceDirectory>
+                    <doctype>book</doctype>
+                    <!-- Attributes common to all output formats -->
+                    <attributes>
+                        <endpoint-url>http://cayenne.apache.org</endpoint-url>
+
+                        <basedir>${project.basedir}</basedir>
+                        <sourcedir>${project.build.sourceDirectory}</sourcedir>
+                        <project-version>${project.version}</project-version>
+                        <project-major-version>${cayenne.major.version}</project-major-version>
+
+                        <imagesdir>images</imagesdir>
+                        <icons>font</icons>
+
+                        <sectanchors>true</sectanchors>
+                        <idprefix/> <!-- set the idprefix to blank -->
+                        <idseparator>-</idseparator>
+                        <!--
+                        currently it is not possible to specify header location inside final document, so can't use
+                        asciidoc's *-docinfo.html as header, instead we use extension that deal with our header
+                         -->
+                        <!--<docinfo>private</docinfo1>-->
+                    </attributes>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.jruby</groupId>
+                        <artifactId>jruby-complete</artifactId>
+                        <version>${jruby.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/pom.xml b/docs/asciidoc/upgrade-guide/pom.xml
new file mode 100644
index 0000000..f22ea3d
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/pom.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.parents</groupId>
+        <artifactId>cayenne-asciidoc-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>upgrade-guide</artifactId>
+
+    <packaging>jar</packaging>
+    <name>upgrade-guide: Cayenne 3.1 New Features and Upgrade Guide</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.asciidoctor</groupId>
+                <artifactId>asciidoctor-maven-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cayenne.docs</groupId>
+                        <artifactId>cayenne-asciidoc-extension</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <!-- generate "embeddable" html content with front matter and without header/footer/styles -->
+                    <execution>
+                        <id>asciidoctor-html-web</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>process-asciidoc</goal>
+                        </goals>
+                        <configuration>
+                            <backend>html5</backend>
+                            <headerFooter>false</headerFooter> <!-- do not generate header and footer -->
+                            <outputDirectory>${project.build.directory}/tmp/</outputDirectory>
+                            <extensions>
+                                <extension>
+                                    <className>org.apache.cayenne.asciidoc.CayennePostProcessor</className>
+                                </extension>
+                            </extensions>
+                            <attributes>
+                                <toc>auto</toc>
+                            </attributes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Move images to proper path for site -->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy docs for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/</directory>
+                                    <includes>
+                                        <include>${project.artifactId}.html</include>
+                                        <include>${project.artifactId}.toc.html</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy images for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/${project.artifactId}/images/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/images/</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>assembly</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.asciidoctor</groupId>
+                        <artifactId>asciidoctor-maven-plugin</artifactId>
+                        <executions>
+                            <!-- generate standalone html help -->
+                            <execution>
+                                <id>asciidoctor-html-standalone</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>html5</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <embedAssets>true</embedAssets>
+                                    <attributes>
+                                        <toc>left</toc>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+
+                            <!-- generate PDF -->
+                            <execution>
+                                <id>generate-pdf-doc</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>pdf</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <attributes>
+                                        <pagenums/>
+                                        <toc/>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/cayenne-configuration.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/cayenne-configuration.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/cayenne-configuration.adoc
new file mode 100644
index 0000000..89e8694
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/cayenne-configuration.adoc
@@ -0,0 +1,47 @@
+// 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.
+
+=== Cayenne Configuration
+
+NOTE: The new DI-based bootstrap and configuration approach is not API-compatible with earlier versions of Cayenne. Make sure you read the `UPGRADE.txt` file for instructions how to upgrade the existing projects.
+
+==== Dependency Injection Container
+
+Cayenne 3.1 runtime stack is built around the ideas of Dependency Injection (DI), making it extremely flexible and easy to extend. It bundles a small, flexible annotations-based DI container to configure its services. The container provides DI services and exposes Cayenne extension points, but does not interfere with other DI containers that may be present in the application. I.e. it is invisible to the users who do not care about advanced Cayenne customization.
+
+==== Bootstrapping Cayenne in Various Environments
+
+Here is a simple example of starting a server-side Cayenne stack:
+
+[source, java]
+----
+ServerRuntime runtime = new ServerRuntime("cayenne-UntitledDomain.xml");
+----
+
+For more detailed examples check the tutorials and other documentation.
+
+==== Configuring Local DataSources, Removal of JNDI Hack
+
+Cayenne 3.1 provides a property-based mechanism to override Modeler DataSource definitions, regardless of whether they are driver configurations, JNDI, DBCP, etc. A quick configuration example is shown below:
+
+[source]
+----
+-Dcayenne.jdbc.driver=com.mysql.jdbc.Driver -Dcayenne.jdbc.url=jdbc:mysql://localhost/mydb \
+-Dcayenne.jdbc.username=user -Dcayenne.jdbc.password=password
+----
+
+For more details and configuration options see javadocs of `org.apache.cayenne.configuration.server.PropertyDataSourceFactory`.
+
+This feature supersedes what was formerly known as "JNDI hack", i.e. JNDI DataSource failover load strategy based on CayenneModeler preferences database. The problem with JNDI hack was unstable and frequently corrupted preferences database, and the need to include hsqldb and cayenne-modeler jars in the runtime.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/content-structure.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/content-structure.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/content-structure.adoc
new file mode 100644
index 0000000..893135a
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/content-structure.adoc
@@ -0,0 +1,26 @@
+// 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.
+
+This guide highlights the new features and changes introduced in 3.1 release. It is a high-level overview. For more details consult *RELEASE-NOTES.txt* file included in each release for the full list of changes, and UPGRADE.txt for the release-specific upgrade instructions.
+
+=== Distribution Contents Structure
+
+Cayenne distribution is made leaner and more modular:
+
+- "cayenne-modeler.jar" is no longer included in the "lib" folder, as it is no longer used for loading local JNDI overrides. Of course "CayenneModeler-the-app" is still included.
+
+- Ashwood library used for commit operation sorting is no longer a third-party dependency. Instead a small subset of the relevant Ashwood classes got included in Cayenne core.
+
+- The following helper modules are split away from Cayenne core: "cayenne-project" and "cayenne-wocompat". They are bundled in CayenneModeler, and are available from the source distribution. They are not included as standalone jars in the binary distribution.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/features.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/features.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/features.adoc
new file mode 100644
index 0000000..f3f4720
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/features.adoc
@@ -0,0 +1,25 @@
+// 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.
+
+== Guide to 3.1 Features
+
+include::content-structure.adoc[]
+
+include::cayenne-configuration.adoc[]
+
+include::framework.adoc[]
+
+include::modeler.adoc[]
+
+include::lifecycle.adoc[]

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/framework.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/framework.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/framework.adoc
new file mode 100644
index 0000000..0408ee6
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/framework.adoc
@@ -0,0 +1,75 @@
+// 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.
+
+=== Framework API
+
+See UPGRADE.txt for the full list of changes
+
+==== Lifecycle Listener Annotations
+
+Cayenne 3.1 features support for annotations on lifecycle listeners (but not yet on entity callback methods) that simplifies registering listeners via API. Our experience with Cayenne 3.0 shows that mapping listeners in the Modeler doesn't scale well to complex applications, and 3.0 API for mapping the listeners is hard to use. In 3.1 you can annotate listener methods and register multiple callback methods with a single call.
+
+[source, java]
+----
+// declare a listener with annotated methods
+class MyListener {
+    @PostLoad(Entity1.class)
+    @PostPersist(Entity1.class)
+    void postLoad(Object object) {
+        ....
+    }
+}
+
+// register a listener
+ServerRuntime runtime = ..
+MyListener listener = new MyListener();
+runtime.getChannel().getEntityResolver().getCallbackRegistry().addListener(listener);
+----
+
+Moreover, unlike JPA annotations, Cayenne allows to attach a listener to a set of entities not known to the listener upfront, but that are all annotated with some custom annotation:
+
+[source,java]
+----
+class MyListener {
+    @PostLoad(entityAnnotations = CustomAnnotation.class)
+    void postLoad(Object object) {
+        ....
+    }
+}
+----
+
+==== DataChannelFilter for Intercepting DataDomain Operations
+
+Cayenne now features a DataChannelFilter interface that allows to intercept and alter all DataChannel traffic (i.e. selects and commits between a DataContext and DataDomain). It provides a chain of command API very similar to servlet filters. Filters are widely used by "cayenne-lifecyle" extensions and allow to build powerful custom object lifecycle-aware code. To install a filter, the following API is used:
+
+[source, java]
+----
+class MyFilter implement DataChannelFilter { .. }
+
+MyFilter filter = new MyFilter();
+ServerRuntime runtime = ..
+runtime.getDataDomain().addFilter(filter);
+----
+
+Very often filters mark some of their own methods with lifecycle annotations so that certain operations can be triggered by Cayenne inside the scope of filter's onQuery() or onSync() methods. To ensure annotated methods are invoked, filter registration should be combined with listener registration:
+
+[source, java]
+----
+MyFilter filter = new MyFilter();
+ServerRuntime runtime = ..
+runtime.getDataDomain().addFilter(filter);
+runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(filter);
+// noticed that by default runtime.getDataDomain() is equivalent to runtime.getChannel()
+----
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
new file mode 100644
index 0000000..c5eedd9
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/header.html
@@ -0,0 +1,24 @@
+---
+#  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.
+
+title: "Guide to 3.1 Features"
+description: "This guide highlights the new features and changes introduced in Apache Cayenne 3.1"
+cayenneVersion: "3.1"
+docsMenuTitle: "Upgrade Guide"
+weight: 50
+---

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/lifecycle.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/lifecycle.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/lifecycle.adoc
new file mode 100644
index 0000000..5bc5384
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/lifecycle.adoc
@@ -0,0 +1,18 @@
+// 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.
+
+=== Lifecycle Extensions
+
+Cayenne 3.1 includes an optional cayenne-lifecyle module that implements a few useful extensions based on DataChannelFilters and lifecycle annotations. Those include a concept of a String ID (which is a String URL-friendly representation of ObjectId), support for (de)referencing objects by String ID, String ID-based relationships, annotation-based cache groups invalidation, annotation-based audit of object changes, etc.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/modeler.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/modeler.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/modeler.adoc
new file mode 100644
index 0000000..ea6d48d
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/modeler.adoc
@@ -0,0 +1,20 @@
+// 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.
+
+=== CayenneModeler
+
+==== Java Preferences API
+
+We got rid of HSQLDB-based preferences storage, and are using standard Java Preferences API for the Modeler preferences. This solved a long-standing stability issue with Modeler preferences. So no more lost user preferences.
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
new file mode 100644
index 0000000..78f0c1c
--- /dev/null
+++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc
@@ -0,0 +1,44 @@
+// 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.
+= Cayenne New Features and Upgrade Guide
+:revnumber: {project-major-version} ({project-version})
+// enable section numbering, limiting depth to 2
+:sectnums:
+:sectnumlevels: 2
+// use custom header
+:cayenne-header: _upgrade_guide/header.html
+:cayenne-header-position: body
+// customize final layout
+//:linkcss:
+// base path to java code include
+:cayenne-root: {basedir}/../../..
+
+[small]#Copyright © 2011-2017 Apache Software Foundation and individual authors#
+
+.License
+[small]#_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_#
+
+[small]#_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._#
+
+include::_upgrade-guide/features.adoc[]
+
+
+
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/pom.xml b/docs/docbook/cayenne-guide/pom.xml
deleted file mode 100644
index 0620ff8..0000000
--- a/docs/docbook/cayenne-guide/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.   
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.apache.cayenne.docs</groupId>
-		<artifactId>cayenne-docbook</artifactId>
-		<version>3.1.3-SNAPSHOT</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.cayenne.docs</groupId>
-	<artifactId>cayenne-guide</artifactId>
-	<name>Docbook: Cayenne Guide</name>
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml b/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml
deleted file mode 100644
index e36f681..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/appendix-a.xml
+++ /dev/null
@@ -1,184 +0,0 @@
-<?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.
--->
-<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="configuration-properties">
-    <title>Configuration Properties</title>
-    <para>Note that the property names below are defined as constants in
-            <code>org.apache.cayenne.configuration.Constants</code> interface. </para>
-    <para>
-        <table frame="void">
-            <caption>Configuration Properties Recognized by ServerRuntime and/or ClientRuntime</caption>
-            <col width="67%"/>
-            <col width="15%"/>
-            <col width="18%"/>
-            <thead>
-                <tr>
-                    <th>Property</th>
-                    <th>Possible Values</th>
-                    <th>Default Value</th>
-                </tr>
-            </thead>
-            <tbody>
-                <tr>
-                    <td><code>cayenne.jdbc.driver[.domain_name.node_name]</code> - defines a JDBC driver class to
-                        use when creating a DataSource. If domain name and optionally - node name
-                        are specified, the setting overrides DataSource info just for this
-                        domain/node. Otherwise the override is applied to all domains/nodes in the
-                        system.</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.jdbc.url[.domain_name.node_name] </code>- defines a DB URL to use when
-                        creating a DataSource. If domain name and optionally - node name are
-                        specified, the setting overrides DataSource info just for this domain/node.
-                        Otherwise the override is applied to all domains/nodes in the system.</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.jdbc.username[.domain_name.node_name] </code>- defines a DB user name to use
-                        when creating a DataSource. If domain name and optionally - node name are
-                        specified, the setting overrides DataSource info just for this domain/node.
-                        Otherwise the override is applied to all domains/nodes in the system.</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.jdbc.password[.domain_name.node_name]</code> - defines a DB password to use
-                        when creating a DataSource. If domain name and optionally - node name are
-                        specified, the setting overrides DataSource info just for this domain/node.
-                        Otherwise the override is applied to all domains/nodes in the system</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.jdbc.min_connections[.domain_name.node_name]</code> - defines the DB
-                        connection pool minimal size. If domain name and optionally - node name are
-                        specified, the setting overrides DataSource info just for this domain/node.
-                        Otherwise the override is applied to all domains/nodes in the system</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.jdbc.max_connections[.domain_name.node_name]</code> - defines the DB
-                        connection pool maximum size. If domain name and optionally - node name are
-                        specified, the setting overrides DataSource info just for this domain/node.
-                        Otherwise the override is applied to all domains/nodes in the system</td>
-                    <td/>
-                    <td>none, project DataNode configuration is used</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.querycache.size</code> - An integer defining the maximum number of entries in
-                        the query cache. Note that not all QueryCache providers may respect this
-                        property. MapQueryCache uses it, but the rest would use alternative
-                        configuration methods.</td>
-                    <td>any positive int value</td>
-                    <td>2000</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.contexts_sync_strategy</code> - defines whether peer ObjectContexts
-                        should receive snapshot events after commits from other contexts. If true
-                        (default), the contexts would automatically synchronize their state with
-                        peers.</td>
-                    <td>true, false</td>
-                    <td>true</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.object_retain_strategy</code> - defines fetched objects retain
-                        strategy for ObjectContexts. When weak or soft strategy is used, objects
-                        retained by ObjectContext that have no local changes can potetially get
-                        garbage collected when JVM feels like doing it.</td>
-                    <td>weak, soft, hard</td>
-                    <td>weak</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.max_id_qualifier_size</code> - defines a maximum number of ID
-                        qualifiers in the WHERE  clause of queries that are generated for paginated
-                        queries and for DISJOINT_BY_ID prefetch processing. This is needed to avoid
-                        hitting WHERE clause size limitations and memory usage efficiency.</td>
-                    <td>any positive int</td>
-                    <td>10000</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.service_url</code> - defines the URL of the ROP server</td>
-                    <td/>
-                    <td/>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.service_username</code> - defines the user name for an ROP client to
-                        login to an ROP server.</td>
-                    <td/>
-                    <td/>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.service_password</code> - defines the password for an ROP client to login
-                        to an ROP server.</td>
-                    <td/>
-                    <td/>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.shared_session_name</code>- defines the name of the shared session that
-                        an ROP client wants to join on an ROP server. If omitted, a dedicated
-                        session is created.</td>
-                    <td/>
-                    <td/>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.service.timeout</code> - a value in milliseconds for the
-                        ROP client-server connection read operation timeout</td>
-                    <td>any positive long value</td>
-                    <td/>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.channel_events</code> - defines whether client-side DataChannel should
-                        dispatch events to child ObjectContexts. If set to true, ObjectContexts will
-                        receive commit events and merge changes committed by peer contexts that
-                        passed through the common client DataChannel.</td>
-                    <td>true, false</td>
-                    <td>false</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.context_change_events</code>- defines whether object property changes in
-                        the client context result in firing events. Client UI components can listen
-                        to these events and update the UI. Disabled by default.</td>
-                    <td>true, false</td>
-                    <td>false</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.rop.context_lifecycle_events</code> - defines whether object commit and
-                        rollback operations in the client context result in firing events. Client UI
-                        components can listen to these events and update the UI. Disabled by
-                        default.</td>
-                    <td>true,false</td>
-                    <td>false</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.rop_event_bridge_factory</code> - defines the name of
-                        the org.apache.cayenne.event.EventBridgeFactory that is passed from the ROP
-                        server to the client. I.e. server DI would provide a name of the factory,
-                        passing this name to the client via the wire. The client would instantiate
-                        it to receive events from the server. Note that this property is stored in
-                        "cayenne.server.rop_event_bridge_properties" map, not in the main
-                        "cayenne.properties".</td>
-                    <td/>
-                    <td/>
-                </tr>
-            </tbody>
-        </table>
-    </para>
-</appendix>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/appendix-b.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/appendix-b.xml b/docs/docbook/cayenne-guide/src/docbkx/appendix-b.xml
deleted file mode 100644
index cf0f035..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/appendix-b.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?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.
--->
-<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="service-collections">
-    <title>Service Collections</title>
-    <para>Note that the collection keys below are
-                defined as constants in <code>org.apache.cayenne.configuration.Constants</code>
-                interface.</para>
-    <para>
-        <table frame="void">
-            <caption>Service Collection Keys Present in ServerRuntime and/or ClientRuntime</caption>
-            <col width="42%"/>
-            <col width="25%"/>
-            <col width="33%"/>
-            <thead>
-                <tr>
-                    <th>Collection Property</th>
-                    <th>Type</th>
-                    <th>Description</th>
-                </tr>
-            </thead>
-            <tbody>
-                <tr>
-                    <td><code>cayenne.properties</code></td>
-                    <td><code>Map&lt;String,String></code></td> 
-                    <td>Properties used by built-in
-                        Cayenne services. The keys in this map are the property names from the table
-                        in Appendix A. Separate copies of this map exist on the server and ROP
-                        client.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.adapter_detectors</code></td>
-                    <td><code>List&lt;DbAdapterDetector></code></td>
-                    <td>Contains
-                        objects that can discover the type of current database and install the
-                        correct DbAdapter in runtime.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.domain_filters</code></td>
-                    <td><code>List&lt;DataChannelFilter></code></td>
-                    <td>Stores DataDomain filters.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.project_locations</code></td>
-                    <td><code>List&lt;String></code></td>
-                    <td>Stores locations of the one of more project configuration files.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.default_types</code></td>
-                    <td><code>List&lt;ExtendedType></code></td>
-                    <td>Stores default adapter-agnostic ExtendedTypes. Default ExtendedTypes can be
-                        overridden / extended by DB-specific DbAdapters as well as by user-provided
-                        types configured in another colltecion (see
-                        <code>"cayenne.server.user_types"</code>).</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.user_types</code></td>
-                    <td><code>List&lt;ExtendedType></code></td>
-                    <td>Stores a
-                        user-provided ExtendedTypes. This collection will be merged into a full list
-                        of ExtendedTypes and would override any ExtendedTypes defined in a default
-                        list, or by a DbAdapter.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.type_factories</code></td>
-                    <td><code>List&lt;ExtendedTypeFactory></code></td>
-                    <td>Stores default and user-provided ExtendedTypeFactories. ExtendedTypeFactory
-                        allows to define ExtendedTypes dynamically for the whole group of Java
-                        classes. E.g. Cayenne supplies a factory to map all Enums regardless of
-                        their type.</td>
-                </tr>
-                <tr>
-                    <td><code>cayenne.server.rop_event_bridge_properties</code></td>
-                    <td><code>Map&lt;String, String></code></td>
-                    <td>Stores event bridge properties passed to the ROP client on
-                        bootstrap. This means that the map is configured by server DI, and passed to
-                        the client via the wire. The properties in this map are specific to
-                        EventBridgeFactory implementation (e.g JMS or XMPP connection prameters).
-                        One common property is <code>"cayenne.server.rop_event_bridge_factory"</code> that
-                        defines the type of the factory.</td>
-                </tr>
-            </tbody>
-        </table>
-    </para>
-
-</appendix>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/appendix-c.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/appendix-c.xml b/docs/docbook/cayenne-guide/src/docbkx/appendix-c.xml
deleted file mode 100644
index 8b036af..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/appendix-c.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?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.
--->
-<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="expressions-bnf">
-    <title>Expressions BNF</title>
-    <para>
-        <programlisting>
-TOKENS
-&lt;DEFAULT> SKIP : {
-" "
-| "\t"
-| "\n"
-| "\r"
-}
-
-&lt;DEFAULT> TOKEN : {
-&lt;NULL: "null" | "NULL">
-| &lt;TRUE: "true" | "TRUE">
-| &lt;FALSE: "false" | "FALSE">
-}
-
-&lt;DEFAULT> TOKEN : {
-&lt;PROPERTY_PATH: &lt;IDENTIFIER> ("." &lt;IDENTIFIER>)*>
-}
-
-&lt;DEFAULT> TOKEN : {
-&lt;IDENTIFIER: &lt;LETTER> (&lt;LETTER> | &lt;DIGIT>)* (["+"])?>
-| &lt;#LETTER: ["_","a"-"z","A"-"Z"]>
-| &lt;#DIGIT: ["0"-"9"]>
-}
-
-/** 
- * Quoted Strings, whose object value is stored in the token manager's
- * "literalValue" field. Both single and double qoutes are allowed 
- */&lt;DEFAULT> MORE : {
-"\'" : WithinSingleQuoteLiteral
-| "\"" : WithinDoubleQuoteLiteral
-}
-
-&lt;WithinSingleQuoteLiteral> MORE : {
-&lt;ESC: "\\" (["n","r","t","b","f","\\","\'","`","\""] | (["0"-"3"])? ["0"-"7"] (["0"-"7"])?)> : {
-| &lt;~["\'","\\"]> : {
-}
-
-&lt;WithinSingleQuoteLiteral> TOKEN : {
-&lt;SINGLE_QUOTED_STRING: "\'"> : DEFAULT
-}
-
-&lt;WithinDoubleQuoteLiteral> MORE : {
-&lt;STRING_ESC: &lt;ESC>> : {
-| &lt;~["\"","\\"]> : {
-}
-
-&lt;WithinDoubleQuoteLiteral> TOKEN : {
-&lt;DOUBLE_QUOTED_STRING: "\""> : DEFAULT
-}
-
-/**
- * Integer or real Numeric literal, whose object value is stored in the token manager's
- * "literalValue" field.
- */&lt;DEFAULT> TOKEN : {
-&lt;INT_LITERAL: ("0" (["0"-"7"])* | ["1"-"9"] (["0"-"9"])* | "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+)
-        (["l","L","h","H"])?> : {
-| &lt;FLOAT_LITERAL: &lt;DEC_FLT> (&lt;EXPONENT>)? (&lt;FLT_SUFF>)? | &lt;DEC_DIGITS> &lt;EXPONENT> (&lt;FLT_SUFF>)?
-| &lt;DEC_DIGITS> &lt;FLT_SUFF>> : {
-| &lt;#DEC_FLT: (["0"-"9"])+ "." (["0"-"9"])* | "." (["0"-"9"])+>
-| &lt;#DEC_DIGITS: (["0"-"9"])+>
-| &lt;#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+>
-| &lt;#FLT_SUFF: ["d","D","f","F","b","B"]>
-}
-
-NON-TERMINALS
-    expression    :=    orCondition &lt;EOF>
-    orCondition    :=    andCondition ( "or" andCondition )*
-    andCondition    :=    notCondition ( "and" notCondition )*
-    notCondition    :=    ( "not" | "!" ) simpleCondition
-        |    simpleCondition
-    simpleCondition    :=    &lt;TRUE>
-        |    &lt;FALSE>
-        |    scalarConditionExpression
-             ( simpleNotCondition 
-               | ( "=" | "==" ) scalarExpression 
-               | ( "!=" | "&lt;>" ) scalarExpression 
-               | "&lt;=" scalarExpression 
-               | "&lt;" scalarExpression | ">" scalarExpression 
-               | ">=" scalarExpression 
-               | "like" scalarExpression 
-               | "likeIgnoreCase" scalarExpression 
-               | "in" ( namedParameter | "(" scalarCommaList ")" ) 
-               | "between" scalarExpression "and" scalarExpression 
-             )?
-    simpleNotCondition    :=    ( "not" | "!" )
-             ( "like" scalarExpression 
-               | "likeIgnoreCase" scalarExpression 
-               | "in" ( namedParameter | "(" scalarCommaList ")" ) 
-               | "between" scalarExpression "and" scalarExpression 
-             )
-    scalarCommaList    :=    ( scalarConstExpression ( "," scalarConstExpression )* )
-    scalarConditionExpression    :=    scalarNumericExpression
-        |    &lt;SINGLE_QUOTED_STRING>
-        |    &lt;DOUBLE_QUOTED_STRING>
-        |    &lt;NULL>
-    scalarExpression    :=    scalarConditionExpression
-        |    &lt;TRUE>
-        |    &lt;FALSE>
-    scalarConstExpression    :=    &lt;SINGLE_QUOTED_STRING>
-        |    &lt;DOUBLE_QUOTED_STRING>
-        |    namedParameter
-        |    &lt;INT_LITERAL>
-        |    &lt;FLOAT_LITERAL>
-        |    &lt;TRUE>
-        |    &lt;FALSE>
-    scalarNumericExpression    :=    multiplySubtractExp
-             ( "+" multiplySubtractExp | "-" multiplySubtractExp )*
-    multiplySubtractExp    :=    numericTerm ( "*" numericTerm | "/" numericTerm )*
-    numericTerm    :=    ( "+" )? numericPrimary
-        |    "-" numericPrimary
-    numericPrimary    :=    "(" orCondition ")"
-        |    pathExpression
-        |    namedParameter
-        |    &lt;INT_LITERAL>
-        |    &lt;FLOAT_LITERAL>
-    namedParameter    :=    "$" &lt;PROPERTY_PATH>
-    pathExpression    :=    ( &lt;PROPERTY_PATH>
-                            | "obj:" &lt;PROPERTY_PATH>  
-                            | "db:" &lt;PROPERTY_PATH>  
-                            | "enum:" &lt;PROPERTY_PATH>  )
-
-</programlisting>
-    </para>
-
-    
-</appendix>


[08/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/delete.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/delete.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/delete.adoc
new file mode 100644
index 0000000..fdc2bb5
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/delete.adoc
@@ -0,0 +1,72 @@
+// 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.
+=== Deleting Objects
+This chapter explains how to model relationship delete rules and how to delete individual
+objects as well as sets of objects. Also demonstrated the use of Cayenne class to run a
+query.
+
+==== Setting Up Delete Rules
+Before we discuss the API for object deletion, lets go back to CayenneModeler and set up some delete rules. Doing this is optional but will simplify correct handling of the objects related to deleted objects.
+
+In the Modeler go to "Artist" ObjEntity, "Relationships" tab and select "Cascade" for the "paintings" relationship delete rule:
+
+image::modeler-deleterule.png[]
+        
+Repeat this step for other relationships:
+
+- For Gallery set "paintings" relationship to be "Nullify", as a painting can exist without being displayed in a gallery.
+- For Painting set both relationships rules to "Nullify".
+
+Now save the mapping.
+
+==== Deleting Objects
+While deleting objects is possible via SQL, qualifying a delete on one or more IDs, a
+more common way in Cayenne (or ORM in general) is to get a hold of the object first, and
+then delete it via the context. Let's use utility class Cayenne to find an
+artist:
+
+[source, java]
+----
+Expression qualifier = ExpressionFactory.matchExp(Artist.NAME_PROPERTY, "Pablo Picasso");
+SelectQuery select = new SelectQuery(Artist.class, qualifier);
+Artist picasso = (Artist) Cayenne.objectForQuery(context, select);
+----
+
+Now let's delete the artist:
+
+[source, java]
+----
+if (picasso != null) {
+    context.deleteObject(picasso);
+    context.commitChanges();
+}
+}
+----
+Since we set up "Cascade" delete rule for the Artist.paintings relationships, Cayenne
+will automatically delete all paintings of this artist. So when your run the app you'll
+see this output:
+        
+    INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
+          WHERE t0.NAME = ? [bind: 1->NAME:'Pablo Picasso'] - prepared in 6 ms.
+    INFO: === returned 1 row. - took 18 ms.
+    INFO: +++ transaction committed.
+    INFO: --- transaction started.
+    INFO: DELETE FROM PAINTING WHERE ID = ?
+    INFO: [batch bind: 1->ID:200]
+    INFO: [batch bind: 1->ID:201]
+    INFO: === updated 2 rows.
+    INFO: DELETE FROM ARTIST WHERE ID = ?
+    INFO: [batch bind: 1->ID:200]
+    INFO: === updated 1 row.
+    INFO: +++ transaction committed.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
new file mode 100644
index 0000000..7153132
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/header.html
@@ -0,0 +1,24 @@
+---
+#  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.
+
+title: "Cayenne Getting Started Guide"
+description: "Cayenne Getting Started Guide"
+docsMenuTitle: "Getting Started"
+cayenneVersion: "3.1"
+weight: 10
+---

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/java-classes.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/java-classes.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/java-classes.adoc
new file mode 100644
index 0000000..efdd555
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/java-classes.adoc
@@ -0,0 +1,70 @@
+//    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.
+
+include::var.adoc[]
+
+=== Creating Java Classes
+Here we'll generate the Java classes from the model that was created in the previous
+section. CayenneModeler can be used to also generate the database schema, but since we
+specified "`CreateIfNoSchemaStrategy`" earlier when we created a DataNode, we'll skip the
+database schema step. Still be aware that you can do it if you need to via "Tools >
+Create Database Schema".
+
+==== Creating Java Classes
+- Select "Tools > Generate Classes" menu.
+- For "Type" select "Standard Persistent Objects", if it is not already selected.
+- For the "Output Directory" select "`src/main/java`" folder under your IDEA
+project folder (this is a "peer" location to the `cayenne-*.xml` location we
+selected before).
+- Click on "Classes" tab and check the "Check All Classes" checkbox
+(unless it is already checked and reads "Uncheck all Classes").
+- Click "Generate"
+
+Now go back to Eclipse, right click on "tutorial" project and select "Refresh" - you should see pairs of classes generated for each mapped entity. You probably also see that there's a bunch of red squiggles next to the newly generated Java classes in Eclipse. This is because our project does not include Cayenne as a Maven dependency yet. Let's fix it now by adding "cayenne-server" artifact in the bottom of the pom.xml file. The resulting POM should look like this:
+
+[source,xml,subs="verbatim,attributes"]
+----
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.example.cayenne</groupId>
+    <artifactId>tutorial</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-server</artifactId>
+   <!-- Here specify the version of Cayenne you are actually using -->
+            <version>{version}</version>
+        </dependency>
+    </dependencies>
+</project>
+----
+Your computer must be connected to the internet. Once you save the pom.xml, Eclipse will download the needed Cayenne jar file and add it to the project build path. As a result, all the errors should disappear.
+        
+image::eclipse-generatedclasses.png[align="center"]
+
+Now let's check the entity class pairs. Each one is made of a superclass (e.g. Artist) and a subclass (e.g. Artist). You should not modify the superclasses whose names start with "_" (underscore), as they will be replaced on subsequent generator runs. Instead all custom logic should be placed in the subclasses in "org.example.cayenne.persistent" package - those will never be overwritten by the class generator.
+
+[TIP]
+.Class Generation Hint
+====
+Often you'd start by generating classes from the
+Modeler, but at the later stages of the project the generation is usually
+automated either via Ant cgen task or Maven cgen mojo. All three methods are
+interchangeable, however Ant and Maven methods would ensure that you never
+forget to regenerate classes on mapping changes, as they are integrated into
+the build cycle.
+====

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-context.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-context.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-context.adoc
new file mode 100644
index 0000000..43b2dba
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-context.adoc
@@ -0,0 +1,86 @@
+// 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.
+=== Getting started with ObjectContext
+In this section we'll write a simple main class to run our application, and get a brief
+introduction to Cayenne ObjectContext.
+
+==== Creating the Main Class
+
+- n Eclipse create a new class called "Main" in the "org.example.cayenne" package.
+- Create a standard "main" method to make it a runnable class:
+
+[source,java]
+----
+package org.example.cayenne;
+
+public class Main {
+
+    public static void main(String[] args) {
+    }
+}
+----
+- The first thing you need to be able to access the database is to create a
+`ServerRuntime` object (which is essentially a wrapper around Cayenne stack) and
+use it to obtain an instance of an
+`ObjectContext`.
+
+[source,java]
+----
+package org.example.cayenne;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.configuration.server.ServerRuntime;
+
+public class Main {
+
+    public static void main(String[] args) {
+        ServerRuntime cayenneRuntime = new ServerRuntime(
+                        "cayenne-project.xml");
+        ObjectContext context = cayenneRuntime.getContext();
+    }
+}
+----
+`ObjectContext` is an isolated "session" in Cayenne that provides all needed API
+to work with data. ObjectContext has methods to execute queries and manage
+persistent objects. We'll discuss them in the following sections. When the first
+ObjectContext is created in the application, Cayenne loads XML mapping files and
+creates a shared access stack that is later reused by other ObjectContexts.
+
+==== Running Application
+Let's check what happens when you run the application. But before we do that we need
+to add another dependency to the `pom.xml` - Apache Derby, our embedded database engine.
+The following piece of XML needs to be added to the
+`<dependencies>...</dependencies>` section, where we already have Cayenne
+jars:
+[source,xml]
+----
+<dependency>
+   <groupId>org.apache.derby</groupId>
+   <artifactId>derby</artifactId>
+   <version>10.8.1.2</version>
+</dependency>
+----
+
+Now we are ready to run. Right click the "Main" class in Eclipse and select "Run As > Java Application". In the console you'll see output similar to this, indicating that Cayenne stack has been started:
+In the console you'll see output similar to this, indicating that Cayenne stack has been started:
+
+    INFO: Loading XML configuration resource from file:cayenne-project.xml
+    INFO: loading user name and password.
+    INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+        Driver class: org.apache.derby.jdbc.EmbeddedDriver
+        Min. connections in the pool: 1
+        Max. connections in the pool: 1
+            
+==== How to Configure Cayenne Logging
+Follow the instructions in the logging chapter to tweak verbosity of the logging output.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-relational-mapping.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-relational-mapping.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-relational-mapping.adoc
new file mode 100644
index 0000000..725c7d0
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/object-relational-mapping.adoc
@@ -0,0 +1,111 @@
+// 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.
+=== Getting started with Object Relational Mapping (ORM)
+The goal of this section is to learn how to create a simple Object-Relational model with
+CayenneModeler. We will create a complete ORM model for the following database
+schema:
+
+image::cayenne-tutorial-model.png[align="center"]
+
+NOTE: Very often you'd have an existing database already, and
+    it can be quickly imported in Cayenne via "Tools &gt; Reengineer Database
+    Schema". This will save you lots of time compared to manual mapping. However
+    understanding how to create the mapping by hand is important, so we are showing
+    the "manual" approach below.
+
+==== Mapping Database Tables and Columns
+Lets go back to CayenneModeler where we have the newly created project open and start
+by adding the ARTIST table. Database tables are called *DbEntities*
+in Cayenne mapping (those can be actual tables or database views).
+
+Select "datamap" on the left-hand side project tree and click "Create DbEntity" button image:icon-dbentity.png[]
+(or use "Project &gt; Create DbEntity" menu). A new DbEntity is created. In "DbEntity
+Name" field enter "ARTIST". Then click on "Create Attribute" button image:icon-attribute.png[]
+on the entity toolbar. This action changes the view to the "Attribute"
+tab and adds a new attribute (attribute means a "table column" in this case) called
+"untitledAttr". Let's rename it to ID, make it an `INTEGER` and make it a PK:
+
+image::modeler-artistid.png[align="center"]
+
+Similarly add NAME `VARCHAR(200)` and DATE_OF_BIRTH `DATE` attributes. After that repeat
+this procedure for PAINTING and GALLERY entities to match DB schema shown above.
+
+NOTE: Don't forget to save your project periodically to avoid losing your work. You will also have to refresh the project in Eclipse after every CayenneModeler save, as Eclipse is by default unaware of any changes made in the Modeler.
+
+==== Mapping Database Relationships
+
+Now we need to specify relationships between ARTIST, PAINTING and GALLERY tables.
+Start by creating a one-to-many ARTIST/PAINTING relationship:
+
+- Select the ARTIST DbEntity on the left and click on the "Properties" tab.
+
+- Click on "Create Relationship" button on the entity toolbar image:icon-relationship.png[] - a relationship
+called "untitledRel" is created.
+
+- Choose the "Target" to be "Painting".
+
+- Click on the "Database Mapping" button image:icon-edit.png[] - relationship
+configuration dialog is presented. Here you can assign a name to the
+relationship and also its complimentary reverse relationship. This name can be
+anything (this is really a symbolic name of the database referential
+constraint), but it is recommended to use a valid Java identifier, as this will
+save some typing later. We'll call the relationship "paintings" and reverse
+relationship "artist".
+
+- Click on "Add" button on the right to add a join
+
+- Select "ID" column for the "Source" and "ARTIST_ID" column for the target.
+
+- Relationship information should now look like this:
+
+image::modeler-dbrelationship.png[align="center"]
+
+- Click "Done" to confirm the changes and close the dialog.
+
+- Two complimentary relationships have been created - from ARTIST to PAINTING
+and back. Still you may have noticed one thing is missing - "paintings"
+relationship should be to-many, but "To Many" checkbox is not checked. Let's
+change that - check the checkbox for "paintings" relationship, and then click on
+PAINTING DbEntity, and uncheck "artist" relationship "To Many" to make the
+reverse relationship "to-one" as it should be.
+
+- Repeat the steps above to create a many-to-one relationship from PAINTING to GALLERY, calling the relationships pair
+"gallery" and "paintings".
+
+==== Mapping Java Classes
+
+Now that the database schema mapping is complete, CayenneModeler can create mappings
+of Java classes (aka "ObjEntities") by deriving everything from DbEntities. At present
+there is no way to do it for the entire DataMap in one click, so we'll do it for each
+table individually.
+
+- Select "ARTIST" DbEntity and click on "Create ObjEntity" button image:icon-new_objentity.png[]
+either on the entity toolbar or on the main toolbar. An ObjEntity called
+"Artist" is created with a Java class field set to
+"org.example.cayenne.persistent.Artist". The modeler transformed the database
+names to the Java-friendly names (e.g., if you click on the "Attributes" tab,
+you'll see that "DATE_OF_BIRTH" column was converted to "dateOfBirth" Java class
+attribute).
+
+- Select "GALLERY" DbEntity and click on "Create ObjEntity" button again - you'll see a "Gallery" ObjEntity created.
+- Finally, do the same thing for "PAINTING".
+
+Now you need to synchronize relationships. Artist and Gallery entities were created
+when there was no related "Painting" entity, so their relationships were not set.
+
+- Click on the "Artist" ObjEntity. Now click on "Sync ObjEntity with DbEntity" button on
+the toolbar image:icon-sync.png[] - you will see the "paintings" relationship appear.
+- Do the same for the "Gallery" entity.
+
+Unless you want to customize the Java class and property names (which you can do easily) the mapping is complete.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part2.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part2.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part2.adoc
new file mode 100644
index 0000000..e12d0f0
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part2.adoc
@@ -0,0 +1,20 @@
+// 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.
+== Learning mapping basics
+
+include::starting-project.adoc[]
+
+include::object-relational-mapping.adoc[]
+
+include::java-classes.adoc[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part3.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part3.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part3.adoc
new file mode 100644
index 0000000..cd31060
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/part3.adoc
@@ -0,0 +1,22 @@
+// 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.
+== Learning Cayenne API
+
+include::object-context.adoc[]
+
+include::persistent-objects.adoc[]
+
+include::select-query.adoc[]
+
+include::delete.adoc[]

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/persistent-objects.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/persistent-objects.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/persistent-objects.adoc
new file mode 100644
index 0000000..b7543c7
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/persistent-objects.adoc
@@ -0,0 +1,119 @@
+// 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.
+=== Getting started with persistent objects
+In this chapter we'll learn about persistent objects, how to customize them and how to
+create and save them in DB.
+
+==== Inspecting and Customizing Persistent Objects
+Persistent classes in Cayenne implement a DataObject interface. If you inspect any of
+the classes generated earlier in this tutorial (e.g.
+`org.example.cayenne.persistent.Artist`), you'll see that it extends a class with the name
+that starts with underscore (`org.example.cayenne.persistent.auto._Artist`), which in turn
+extends from `org.apache.cayenne.CayenneDataObject`. Splitting each persistent class into
+user-customizable subclass (`Xyz`) and a generated superclass (`_Xyz`) is a useful technique
+to avoid overwriting the custom code when refreshing classes from the mapping
+model.
+
+Let's for instance add a utility method to the Artist class that sets Artist date of
+birth, taking a string argument for the date. It will be preserved even if the model
+changes later:
+
+[source,java]
+----
+include::{java-include-dir}/persistent/Artist.java[tag=content]
+----
+
+==== Create New Objects
+Now we'll create a bunch of objects and save them to the database. An object is
+created and registered with `ObjectContext` using "`newObject`" method. Objects *must* be registered
+with `DataContext` to be persisted and to allow setting relationships with other objects.
+Add this code to the "main" method of the Main class:
+
+[source,java,indent=0]
+----
+include::{java-include-dir}/Main.java[tag=new-artist]
+----
+
+Note that at this point "picasso" object is only stored in memory and is not saved in
+the database. Let's continue by adding a Metropolitan Museum "`Gallery`" object and a few
+Picasso "Paintings":
+
+[source,java,indent=0]
+----
+include::{java-include-dir}/Main.java[tag=new-painting]
+----
+
+Now we can link the objects together, establishing relationships. Note that in each
+case below relationships are automatically established in both directions (e.g.
+`picasso.addToPaintings(girl)` has exactly the same effect as
+`girl.setToArtist(picasso)`).
+
+[source, java, indent=0]
+----
+include::{java-include-dir}/Main.java[tag=link-objects]
+----
+
+Now lets save all five new objects, in a single method call:
+
+[source, java, indent=0]
+----
+include::{java-include-dir}/Main.java[tag=commit]
+----
+
+Now you can run the application again as described in the previous chapter. The new
+output will show a few actual DB operations:
+
+    ...
+    org.apache.cayenne.configuration.XMLDataChannelDescriptorLoader load
+    INFO: Loading XML configuration resource from file:cayenne-project.xml
+    ...
+    INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+        Login: null
+        Password: *******
+    INFO: +++ Connecting: SUCCESS.
+    INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+    INFO: --- transaction started.
+    INFO: No schema detected, will create mapped tables
+    INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL,
+          NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+    INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+    INFO: CREATE TABLE AUTO_PK_SUPPORT (
+          TABLE_NAME CHAR(100) NOT NULL,  NEXT_ID BIGINT NOT NULL,  PRIMARY KEY(TABLE_NAME))
+    INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+    INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
+    INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
+    INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
+    INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
+    INFO: [batch bind: 1->ID:200, 2->NAME:'Metropolitan Museum of Art']
+    INFO: === updated 1 row.
+    INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
+    INFO: [batch bind: 1->DATE_OF_BIRTH:'1881-10-25 00:00:00.0', 2->ID:200, 3->NAME:'Pablo Picasso']
+    INFO: === updated 1 row.
+    INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
+    INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200, 4->NAME:'Gertrude Stein']
+    INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201, 4->NAME:'Girl Reading at a Table']
+    INFO: === updated 2 rows.
+    INFO: +++ transaction committed.
+
+So first Cayenne creates the needed tables (remember, we used
+"`CreateIfNoSchemaStrategy`"). Then it runs a number of inserts, generating primary keys
+on the fly. Not bad for just a few lines of code.
+    
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/select-query.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/select-query.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/select-query.adoc
new file mode 100644
index 0000000..2e06970
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/select-query.adoc
@@ -0,0 +1,63 @@
+// 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.
+=== Selecting Objects
+This chapter shows how to select objects from the database using `ObjectSelect` query. 
+    
+==== Introducing ObjectSelect
+It was shown before how to persist new objects. Cayenne queries are used to access
+already saved objects. The primary query type used for selecting objects is `ObjectSelect`.
+It can be mapped in CayenneModeler or created
+via the API. We'll use the latter approach in this section. We don't have too much data
+in the database yet, but we can still demonstrate the main principles below.
+
+- Select all paintings (the code, and the log output it generates):
+
+[source,java]
+----
+SelectQuery select1 = new SelectQuery(Painting.class);
+List paintings1 = context.performQuery(select1);
+----
+
+   INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
+   INFO: === returned 2 rows. - took 18 ms.
+
+- Select paintings that start with "`gi`", ignoring case:
+
+[source,java]
+----
+Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
+                Painting.NAME_PROPERTY,
+                "gi%");
+SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
+List paintings2 = context.performQuery(select2);
+----
+    INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 WHERE UPPER(t0.NAME) LIKE UPPER(?)
+          [bind: 1->NAME:'gi%'] - prepared in 6 ms.
+    INFO: === returned 1 row. - took 18 ms.
+
+- Select all paintings done by artists who were born more than a 100 years ago (demonstrating using Expression.fromString(..) instead of ExpressionFactory):
+[source,java]
+----
+Calendar c = new GregorianCalendar();
+c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
+
+Expression qualifier3 = Expression.fromString("artist.dateOfBirth < $date");
+qualifier3 = qualifier3.expWithParameters(Collections.singletonMap("date", c.getTime()));
+SelectQuery select3 = new SelectQuery(Painting.class, qualifier3);
+List paintings3 = context.performQuery(select3);
+----
+
+    INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID)
+          WHERE t1.DATE_OF_BIRTH < ? [bind: 1->DATE_OF_BIRTH:'1911-01-01 00:00:00.493'] - prepared in 7 ms.
+    INFO: === returned 2 rows. - took 25 ms.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/setup.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/setup.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/setup.adoc
new file mode 100644
index 0000000..5e9cd6c
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/setup.adoc
@@ -0,0 +1,31 @@
+// 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.
+== Setting up the environment
+
+The goal of this chapter of the tutorial is to install (or check that you already have
+installed) a minimally needed set of software to build a Cayenne application.
+
+=== Install Java
+
+Obviously, JDK has to be installed. Cayenne 3.1 requires JDK 1.5 or newer.
+
+=== Install Eclipse IDE and the Maven Plugin
+
+Download Eclipse. This tutorial is based on the Galileo package (Eclipse 3.5), JEE edition, still it should work with any recent vanilla Eclipse distribution.
+
+After downloading Eclipse, unpack it somewhere in the filesystem, and start it. The only plugin that you need for the tutorial is m2eclipse. To install it, in Eclipse go to "Help > Install New Software", then click on "Add.." to add a new download site, and enter "Maven" in the "Name" field, and "http://m2eclipse.sonatype.org/sites/m2e" in the "Location" field. You may install any of the optional components that you think you need, but for this tutorial we only select a few basic components as shown on the following screenshot:
+
+image::maven-plugin-install.png[align="center"]
+
+From here follow the Eclipse dialog instructions to finish the installation.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/starting-project.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/starting-project.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/starting-project.adoc
new file mode 100644
index 0000000..4aa7905
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/starting-project.adoc
@@ -0,0 +1,93 @@
+// 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.
+=== Starting a project
+
+The goal of this chapter is to create a new Java project in IntelliJ IDEA
+containing a basic Cayenne mapping. It presents an introduction to
+CayenneModeler GUI tool, showing how to create the initial mapping
+objects: `DataDomain`, `DataNode`, `DataMap`.
+
+==== Create a new Project in Eclipse
+
+In Eclipse select "File > New > Other..." and then "Maven > Maven Project". Click "Next". On the following screen check "Create a simple project" checkbox and click "Next" again. In the dialog shown on the screenshot below, fill the "Group Id" and "Artifact Id" fields and click "Finish".
+
+image::tutorial-idea-project.png[align="center"]
+
+Now you should have a new empty project in the Eclipse workspace. Check that the project Java compiler settings are correct. Rightclick on the "tutorial" project, select "Properties > Java Compiler" and ensure that "Compiler compliance level" is at least "1.5" (some versions of Maven plugin seem to be setting it to 1.4 by default).
+
+==== Download and Start CayenneModeler
+
+Although later in this tutorial we'll be using Maven to include Cayenne
+runtime jars in the project, you'll still need to download Cayenne to
+get access to the CayenneModeler tool.
+
+NOTE: If you are really into Maven, you can start CayenneModeler from Maven too.
+      We'll do it in a more traditional way here.
+
+Download the latest release. Unpack the distribution somewhere in the file system and start CayenneModeler, following platform-specific instructions. On most platforms it is done simply by doubleclicking the Modeler icon. The welcome screen of the Modeler looks like this:
+
+image::modeler-started.png[align="center"]
+
+==== Create a New Mapping Project in CayenneModeler
+
+Click on the `New Project` button on Welcome screen. A new mapping project will appear
+that contains a single *DataDomain*. The meaning of a
+DataDomain is explained elsewhere in the User Guide. For now it is sufficient to
+understand that DataDomain is the root of your mapping project.
+
+==== Create a DataNode
+
+The next project object you will create is a *DataNode*.
+DataNode is a descriptor of a single database your application
+will connect to. Cayenne mapping project can use more than one database, but for now,
+we'll only use one. With "project" selected on the left, click on `Create DataNode` button image:icon-node.png[]
+on the toolbar (or select `Project > Create DataNode` from the menu).
+
+A new DataNode is displayed. Now you need to specify JDBC connection parameters. For
+an in-memory Derby database you can enter the following settings:
+
+- JDBC Driver: org.apache.derby.jdbc.EmbeddedDriver
+- DB URL: jdbc:derby:memory:testdb;create=true
+
+NOTE: We are creating an in-memory database here. So when
+      you stop your application, all the data will be lost. In most real-life
+      cases you'll be connecting to a database that actually persists its data on
+      disk, but an in-memory DB will do for the simple tutorial.
+
+Also you will need to change "Schema Update Strategy". Select
+`org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy` from the dropdown, so that
+Cayenne creates a new schema on Derby based on the ORM mapping when the application
+starts.
+
+image::base-datanode.png[align="center"]
+
+==== Create a DataMap
+
+Now you will create a *DataMap*. DataMap is an object that holds all the mapping information. To create it, click on "Create DataMap" button (or select a corresponding menu item). Note that the newly created DataMap is automatically linked to the DataNode that you created in the previous step. If there is more than one DataNode, you may need to link a DataMap to the correct node manually. In other words a DataMap within DataDomain must point to a database described by the map.
+
+You can leave all the DataMap defaults unchanged except for one - "Java Package". Enter "org.example.cayenne.persistent". This name will later be used for all persistent classes.
+
+image::base-datamap.png[align="center"]
+
+==== Save the Project
+
+Before you proceed with the actual mapping, let's save the project. Click on "Save" button in the toolbar and navigate to the "tutorial" Eclipse project folder that was created earlier in this section and its "src/main/resources" subfolder and save the project there. Now go back to Eclipse, right click on "tutorial" project and select "Refresh", you will see three Cayenne XML files.
+
+image::eclipse-xmlfiles.png[float="right"]
+
+Note that the location of the XML files is not coincidental. Cayenne runtime looks for
+`cayenne-*.xml` file in the application `CLASSPATH` and `src/main/resources` folder should
+already be a "class folder" in Eclipse for our project (and is also a standard location
+that Maven would copy to a jar file, if we were using Maven from command-line).
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/var.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/var.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/var.adoc
new file mode 100644
index 0000000..e575eda
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/var.adoc
@@ -0,0 +1 @@
+:version: {project-version}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/webapp.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/webapp.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/webapp.adoc
new file mode 100644
index 0000000..7a1d170
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/_getting-started-guide/webapp.adoc
@@ -0,0 +1,284 @@
+// 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.
+== Converting to Web Application
+This chapter shows how to work with Cayenne in a web application.
+
+=== Converting Tutorial to a Web Application
+The web part of the web application tutorial is done in JSP, which is the least common
+denominator of the Java web technologies, and is intentionally simplistic from the UI
+perspective, to concentrate on Cayenne integration aspect, rather than the interface. A
+typical Cayenne web application works like this:
+
+- Cayenne configuration is loaded when an application context is started, using a special servlet filter.
+- User requests are intercepted by the filter, and the DataContext is bound to
+the request thread, so the application can access it easily from anywhere.
+- The same DataContext instance is reused within a single user session;
+different sessions use different DataContexts (and therefore different sets of
+objects). The context can be scoped differently
+depending on the app specifics. For the tutorial we'll be using a
+session-scoped context.
+
+So let's convert the tutorial that we created to a web application:
+
+- In Eclipse under "tutorial" project folder create a new folder "src/main/webapp/WEB-INF".
+- Under `WEB-INF` create a new file `web.xml` (a standard web app descriptor):
+
+.web.xml
+[source,xml]
+----
+<?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE web-app
+   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+  "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+    <display-name>Cayenne Tutorial</display-name>
+
+    <!-- This filter bootstraps ServerRuntime and then provides each request thread
+         with a session-bound DataContext. Note that the name of the filter is important,
+         as it points it to the right named configuration file.
+    -->
+    <filter>
+        <filter-name>cayenne-project</filter-name>
+        <filter-class>org.apache.cayenne.configuration.web.CayenneFilter</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>cayenne-project</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+</web-app>
+----
+
+- Create the artist browser page `src/main/webapp/index.jsp` file with the following contents:
+
+.webapp/index.jsp
+[source,jsp]
+----
+<%@ page language="java" contentType="text/html" %>
+<%@ page import="org.example.cayenne.persistent.*" %>
+<%@ page import="org.apache.cayenne.*" %>
+<%@ page import="org.apache.cayenne.query.*" %>
+<%@ page import="org.apache.cayenne.exp.*" %>
+<%@ page import="java.util.*" %>
+
+<%
+    SelectQuery query = new SelectQuery(Artist.class);
+    query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);
+
+    ObjectContext context = BaseContext.getThreadObjectContext();
+    List<Artist> artists = context.performQuery(query);
+%>
+<html>
+    <head>
+        <title>Main</title>
+    </head>
+    <body>
+        <h2>Artists:</h2>
+
+        <% if(artists.isEmpty()) {%>
+        <p>No artists found</p>
+        <% } else {
+            for(Artist a : artists) {
+        %>
+        <p><a href="detail.jsp?id=<%=Cayenne.intPKForObject(a)%>"> <%=a.getName()%> </a></p>
+        <%
+            }
+            } %>
+        <hr>
+        <p><a href="detail.jsp">Create new artist...</a></p>
+    </body>
+</html>
+----
+
+- Create the artist editor page `src/main/webapp/detail.jsp` with the following content:
+
+.webapp/detail.jsp
+[source,jsp]
+----
+<%@ page language="java" contentType="text/html" %>
+<%@ page import="org.example.cayenne.persistent.*" %>
+<%@ page import="org.apache.cayenne.*" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
+
+<%
+    ObjectContext context = BaseContext.getThreadObjectContext();
+    String id = request.getParameter("id");
+
+    // find artist for id
+    Artist artist = null;
+    if(id != null && id.trim().length() > 0) {
+        artist = Cayenne.objectForPK(context, Artist.class, Integer.parseInt(id));
+    }
+
+    if("POST".equals(request.getMethod())) {
+        // if no id is saved in the hidden field, we are dealing with
+        // create new artist request
+        if(artist == null) {
+            artist = context.newObject(Artist.class);
+        }
+
+        // note that in a real application we would so dome validation ...
+        // here we just hope the input is correct
+        artist.setName(request.getParameter("name"));
+        artist.setDateOfBirthString(request.getParameter("dateOfBirth"));
+
+        context.commitChanges();
+
+        response.sendRedirect("index.jsp");
+    }
+
+    if(artist == null) {
+        // create transient artist for the form response rendering
+        artist = new Artist();
+    }
+
+    String name = artist.getName() == null ? "" : artist.getName();
+    String dob = artist.getDateOfBirth() == null
+            ? "" : new SimpleDateFormat("yyyyMMdd").format(artist.getDateOfBirth());
+%>
+<html>
+    <head>
+        <title>Artist Details</title>
+    </head>
+    <body>
+        <h2>Artists Details</h2>
+        <form name="EditArtist" action="detail.jsp" method="POST">
+            <input type="hidden" name="id" value="<%= id != null ? id : "" %>" />
+            <table border="0">
+                <tr>
+                    <td>Name:</td>
+                    <td><input type="text" name="name" value="<%= name %>"/></td>
+                </tr>
+                <tr>
+                    <td>Date of Birth (yyyyMMdd):</td>
+                    <td><input type="text" name="dateOfBirth" value="<%= dob %>"/></td>
+                </tr>
+                <tr>
+                    <td></td>
+                    <td align="right"><input type="submit" value="Save" /></td>
+                </tr>  
+            </table>
+        </form>
+    </body>
+</html>
+----
+
+==== Running Web Application
+To run the web application we'll use "maven-jetty-plugin". To activate it, let's add the following piece of code to the "pom.xml" file, following the "dependencies" section and save the POM:
+
+.pom.xml
+[source,xml]
+----
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>maven-jetty-plugin</artifactId>
+            <version>6.1.22</version>
+        </plugin>
+    </plugins>
+</build>
+
+----
+
+Also to run the web application we'll use "maven-jetty-plugin". To activate it,
+let's add the following piece of code to the `pom.xml` file, following the "dependencies"
+section and save the POM:
+
+.pom.xml
+[source,xml]
+----
+<build>
+    <plugins>
+        <plugin>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>jetty-maven-plugin</artifactId>
+            <version>9.3.14.v20161028</version>
+        </plugin>
+    </plugins>
+</build>
+----
+
+- Go to "Run > Run Configurations..." menu, select "Maven Build", right click and select "New"
+
+- Make sure you fill "Name", "Base directory" and "Goals" fields as shown on the screenshot:
+
+image::eclipse-mvnrun.png[align="center"]
+
+
+- Click "Apply" and "Run". On the first execution it may take a few minutes for Jetty plugin to download all dependencies, but eventually you'll see the logs like this:
+
+    [INFO] Scanning for projects...
+    [INFO]
+    [INFO] ------------------------------------------------------------------------
+    [INFO] Building tutorial 0.0.1-SNAPSHOT
+    [INFO] ------------------------------------------------------------------------
+    ...
+    [INFO] Configuring Jetty for project: tutorial
+    [INFO] Webapp source directory = /.../tutorial/src/main/webapp
+    [INFO] Reload Mechanic: automatic
+    [INFO] Classes = /.../tutorial/target/classes
+    [INFO] Context path = /tutorial
+    [INFO] Tmp directory =  determined at runtime
+    [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
+    [INFO] Web overrides =  none
+    [INFO] web.xml file = /.../tutorial/src/main/webapp/WEB-INF/web.xml
+    [INFO] Webapp directory = /.../tutorial/src/main/webapp
+    [INFO] Starting jetty 6.1.22 ...
+    INFO::jetty-6.1.22
+    INFO::No Transaction manager found - if your webapp requires one, please configure one.
+    INFO::Started SelectChannelConnector@0.0.0.0:8080
+    [INFO] Started Jetty Server
+
+- So the Jetty container just started.
+
+- Now go to http://localhost:8080/tutorial/ URL. You should see "No artists found message" in the web browser and the following output in the Eclipse console:
+
+    INFO: Loading XML configuration resource from file:/.../tutorial/target/classes/cayenne-project.xml
+    INFO: loading user name and password.
+    INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
+        Driver class: org.apache.derby.jdbc.EmbeddedDriver
+        Min. connections in the pool: 1
+        Max. connections in the pool: 1
+    INFO: Opening connection: jdbc:derby:memory:testdb;create=true
+        Login: null
+        Password: *******
+    INFO: +++ Connecting: SUCCESS.
+    INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
+    INFO: --- transaction started.
+    INFO: No schema detected, will create mapped tables
+    INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL,
+          NAME VARCHAR (200), PRIMARY KEY (ID))
+    INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
+    INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
+    INFO: CREATE TABLE AUTO_PK_SUPPORT (
+          TABLE_NAME CHAR(100) NOT NULL,  NEXT_ID BIGINT NOT NULL,  PRIMARY KEY(TABLE_NAME))
+    INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
+    INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
+    INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 ORDER BY t0.NAME - prepared in 43 ms.
+    INFO: === returned 0 rows. - took 56 ms.
+    INFO: +++ transaction committed.
+
+- You can click on "Create new artist" link to create artists. Existing artists can be edited by clicking on their name:
+
+image::firefox-webapp.png[align="center"]
+
+You are done with the tutorial!
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/getting-started-guide.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/getting-started-guide.adoc b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/getting-started-guide.adoc
new file mode 100644
index 0000000..a61dc84
--- /dev/null
+++ b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/getting-started-guide.adoc
@@ -0,0 +1,48 @@
+// 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.
+= Getting Started with Cayenne
+:revnumber: {project-major-version} ({project-version})
+// enable section numbering, limiting depth to 2
+:sectnums:
+:sectnumlevels: 2
+// use custom header
+:cayenne-header: _getting-started/header.html
+:cayenne-header-position: body
+// customize final layout
+//:linkcss:
+// base path to java code include
+:cayenne-root: {basedir}/../../..
+:java-include-dir: {cayenne-root}/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial
+:web-include-dir: {cayenne-root}/tutorials/tutorial/src/main/java/org/apache/cayenne/tutorial
+
+[small]#Copyright © 2011-2017 Apache Software Foundation and individual authors#
+
+.License
+[small]#_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_#
+
+[small]#_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._#
+
+include::_getting-started-guide/setup.adoc[]
+
+include::_getting-started-guide/part2.adoc[]
+
+include::_getting-started-guide/part3.adoc[]
+
+include::_getting-started-guide/webapp.adoc[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datamap.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datamap.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datamap.png
new file mode 100644
index 0000000..98f1ffc
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datamap.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datanode.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datanode.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datanode.png
new file mode 100644
index 0000000..e58da99
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/base-datanode.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/cayenne-tutorial-model.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/cayenne-tutorial-model.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/cayenne-tutorial-model.png
new file mode 100644
index 0000000..454d198
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/cayenne-tutorial-model.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/database-schema.jpg
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/database-schema.jpg b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/database-schema.jpg
new file mode 100644
index 0000000..9d4ee21
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/database-schema.jpg differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/datamap-enableclient.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/datamap-enableclient.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/datamap-enableclient.png
new file mode 100644
index 0000000..62a2af2
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/datamap-enableclient.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-generatedclasses.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-generatedclasses.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-generatedclasses.png
new file mode 100644
index 0000000..89d0dd2
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-generatedclasses.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-mvnrun.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-mvnrun.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-mvnrun.png
new file mode 100644
index 0000000..0f517d6
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-mvnrun.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-xmlfiles.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-xmlfiles.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-xmlfiles.png
new file mode 100644
index 0000000..7cb3856
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/eclipse-xmlfiles.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/firefox-webapp.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/firefox-webapp.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/firefox-webapp.png
new file mode 100644
index 0000000..35be692
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/firefox-webapp.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-attribute.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-attribute.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-attribute.png
new file mode 100755
index 0000000..77a68eb
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-attribute.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-datamap.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-datamap.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-datamap.png
new file mode 100755
index 0000000..2ea96ca
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-datamap.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-dbentity.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-dbentity.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-dbentity.png
new file mode 100755
index 0000000..87d9d8a
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-dbentity.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-edit.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-edit.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-edit.png
new file mode 100755
index 0000000..027c482
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-edit.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-new_objentity.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-new_objentity.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-new_objentity.png
new file mode 100755
index 0000000..8735d7a
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-new_objentity.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-node.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-node.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-node.png
new file mode 100755
index 0000000..2ff4383
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-node.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-relationship.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-relationship.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-relationship.png
new file mode 100755
index 0000000..44ed7eb
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-relationship.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-sync.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-sync.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-sync.png
new file mode 100755
index 0000000..03e8623
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/icon-sync.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-file-run-menu.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-file-run-menu.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-file-run-menu.png
new file mode 100644
index 0000000..30cf05e
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-file-run-menu.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-run-configuration.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-run-configuration.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-run-configuration.png
new file mode 100644
index 0000000..3ebbb62
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/idea-run-configuration.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/maven-plugin-install.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/maven-plugin-install.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/maven-plugin-install.png
new file mode 100644
index 0000000..5091b52
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/maven-plugin-install.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-artistid.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-artistid.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-artistid.png
new file mode 100644
index 0000000..287f0948
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-artistid.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-dbrelationship.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-dbrelationship.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-dbrelationship.png
new file mode 100644
index 0000000..2eecb11
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-dbrelationship.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-deleterule.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-deleterule.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-deleterule.png
new file mode 100644
index 0000000..243bbbb
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-deleterule.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-started.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-started.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-started.png
new file mode 100644
index 0000000..5c93629
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/modeler-started.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/tutorial-idea-project.png
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/tutorial-idea-project.png b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/tutorial-idea-project.png
new file mode 100644
index 0000000..ef39865
Binary files /dev/null and b/docs/asciidoc/getting-started-guide/src/docs/asciidoc/images/tutorial-idea-project.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/pom.xml
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/pom.xml b/docs/asciidoc/getting-started-rop/pom.xml
new file mode 100644
index 0000000..f0e31f8
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/pom.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.parents</groupId>
+        <artifactId>cayenne-asciidoc-parent</artifactId>
+        <version>3.1.3-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>getting-started-rop</artifactId>
+
+    <packaging>jar</packaging>
+    <name>getting-started-rop: AsciiDoc - Getting Started with Cayenne ROP (Remote Object Persistence)</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.asciidoctor</groupId>
+                <artifactId>asciidoctor-maven-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.cayenne.docs</groupId>
+                        <artifactId>cayenne-asciidoc-extension</artifactId>
+                        <version>${project.version}</version>
+                    </dependency>
+                </dependencies>
+
+                <executions>
+                    <!-- generate "embeddable" html content with front matter and without header/footer/styles -->
+                    <execution>
+                        <id>asciidoctor-html-web</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>process-asciidoc</goal>
+                        </goals>
+                        <configuration>
+                            <backend>html5</backend>
+                            <headerFooter>false</headerFooter> <!-- do not generate header and footer -->
+                            <outputDirectory>${project.build.directory}/tmp/</outputDirectory>
+                            <extensions>
+                                <extension>
+                                    <className>org.apache.cayenne.asciidoc.CayennePostProcessor</className>
+                                </extension>
+                            </extensions>
+                            <attributes>
+                                <toc>auto</toc>
+                            </attributes>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!-- Move images to proper path for site -->
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy docs for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/</directory>
+                                    <includes>
+                                        <include>${project.artifactId}.html</include>
+                                        <include>${project.artifactId}.toc.html</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+
+                    <execution>
+                        <id>copy images for site</id>
+                        <phase>install</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/site/${project.artifactId}/images/</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.build.directory}/tmp/images/</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>assembly</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.asciidoctor</groupId>
+                        <artifactId>asciidoctor-maven-plugin</artifactId>
+                        <executions>
+                            <!-- generate standalone html help -->
+                            <execution>
+                                <id>asciidoctor-html-standalone</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>html5</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <embedAssets>true</embedAssets>
+                                    <attributes>
+                                        <toc>left</toc>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+
+                            <!-- generate PDF -->
+                            <execution>
+                                <id>generate-pdf-doc</id>
+                                <phase>generate-resources</phase>
+                                <goals>
+                                    <goal>process-asciidoc</goal>
+                                </goals>
+                                <configuration>
+                                    <backend>pdf</backend>
+                                    <sourceHighlighter>coderay</sourceHighlighter>
+                                    <attributes>
+                                        <pagenums/>
+                                        <toc/>
+                                    </attributes>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/header.html
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/header.html b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/header.html
new file mode 100644
index 0000000..bf559dd
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/header.html
@@ -0,0 +1,24 @@
+---
+#  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.
+
+title: "Cayenne Getting Started ROP"
+description: "Tutorial how to quick start new Cayenne ROP project"
+cayenneVersion: "3.1"
+docsMenuTitle: "Getting Started ROP"
+weight: 40
+---

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1.adoc
new file mode 100644
index 0000000..384f927
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1.adoc
@@ -0,0 +1,17 @@
+// 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.
+
+== Prerequisites
+
+include::part1/prerequisites.adoc[]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1/prerequisites.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1/prerequisites.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1/prerequisites.adoc
new file mode 100644
index 0000000..22587e0
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part1/prerequisites.adoc
@@ -0,0 +1,25 @@
+// 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.
+
+=== Prerequisites
+
+This tutorial starts where "Getting Started with Cayenne" left off. If you have gone through the previous tutorial, and have the "tutorial" project open in Eclipse, you can go directly to the next step. If not, here are the compressed instructions to prepare you for work with ROP:
+
+* Step 1 - Eclipse Setup
+* Step 2 - Create a project
+* Step 3 - Create Cayenne OR Mapping
+* Step 4 - Create Java Classes
+* Step 5 - Convert the project to webapp.
+
+Note that at "Step 5" you can skip the JSP creation part. Just setup web.xml and maven-jetty-plugin in the POM.

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2.adoc
----------------------------------------------------------------------
diff --git a/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2.adoc b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2.adoc
new file mode 100644
index 0000000..0f2c23a
--- /dev/null
+++ b/docs/asciidoc/getting-started-rop/src/docs/asciidoc/_getting-started-rop/part2.adoc
@@ -0,0 +1,23 @@
+// 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.
+
+== Remote Object Persistence Quick Start
+
+include::part2/starting.adoc[]
+
+include::part2/hessianWebServ.adoc[]
+
+include::part2/connect.adoc[]
+
+include::part2/adding.adoc[]
\ No newline at end of file


[06/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml b/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
deleted file mode 100644
index 6f3fb6c..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="cayenne-mapping-structure">
-    <title>Cayenne Mapping Structure</title>
-    <section xml:id="cayenne-project">
-        <title>Cayenne Project</title>
-        <para>A Cayenne project is an XML representation of a model connecting database schema with
-            Java classes. A project is normally created and manipulated via CayenneModeler GUI and
-            then used to initialize Cayenne runtime. A project is made of one or more files. There's
-            always a root project descriptor file in any valid project. It is normally called
-                <code>cayenne-xyz.xml</code>, where "xyz" is the name of the project.</para>
-        <para>Project descriptor can reference DataMap files, one per DataMap. DataMap files are
-            normally called <code>xyz.map.xml</code>, where "xyz" is the name of the DataMap. For
-            legacy reasons this naming convention is different from the convention for the root
-            project descriptor above, and we may align it in the future versions. Here is how a
-            typical project might look on the file
-            system:<programlisting>~: ls -l
-total 24
--rw-r--r--  1 cayenne  staff  491 Jan 28 18:25 cayenne-project.xml
--rw-r--r--  1 cayenne  staff  313 Jan 28 18:25 datamap.map.xml</programlisting></para>
-        <para>DataMap are referenced by name in the root
-            descriptor:<programlisting>&lt;map name="datamap"/></programlisting></para>
-        <para>Map files are resolved by Cayenne by appending <code>.map.xml</code>" extension to the
-            map name, and resolving the resulting string relative to the root descriptor URI. The
-            following sections discuss varios ORM model objects, without regards to their XML
-            representation. XML format details are really unimportant to the Cayenne users.</para>
-    </section>
-    <section xml:id="datamap">
-        <title>DataMap</title>
-        <para>DataMap is a container of persistent entities and other object-relational metadata.
-            DataMap provides developers with a scope to organize their entities, but it does not
-            provide a namespace for entities. In fact all DataMaps present in runtime are combined
-            in a single namespace. Each DataMap must be associated with a DataNode. This is how
-            Cayenne knows which database to use when running a query.</para>
-    </section>
-    <section xml:id="datanode">
-        <title>DataNode</title>
-        <para>DataNode is model of a database. It is actually pretty simple. It has an arbitrary
-            user-provided name and information needed to create or locate a JDBC DataSource. Most
-            projects only have one DataNode, though there may be any number of nodes if
-            needed.</para>
-    </section>
-    <section xml:id="dbentity">
-        <title>DbEntity</title>
-        <para>DbEntity is a model of a single DB table or view. DbEntity is made of DbAttributes
-            that correspond to columns, and DbRelationships that map PK/FK pairs. DbRelationships
-            are not strictly tied to FK constraints in DB, and should be mapped for all logical
-            "relationships" between the tables.</para>
-    </section>
-    <section xml:id="objentity">
-        <title>ObjEntity</title>
-        <para>ObjEntity is a model of a single persistent Java class. ObjEntity is made of
-            ObjAttributes and ObjRelationships. Both correspond to entity class properties. However
-            ObjAttributes represent "simple" properties (normally things like String, numbers,
-            dates, etc.), while ObjRelationships correspond to properties that have a type of
-            another entity. </para>
-        <para>ObjEntity maps to one or more DbEntities. There's always one "root" DbEntity for each
-            ObjEntity. ObjAttribiute maps to a DbAttribute or an Embeddable. Most often mapped
-            DbAttribute is from the root DbEntity. Sometimes mapping is done to a DbAttribute from
-            another DbEntity somehow related to the root DbEntity. Such ObjAttribute is called
-            "flattened". Similarly ObjRelationship maps either to a single DbRelationship, or to a
-            chain of DbRelationships ("flattened" ObjRelationship).</para>
-        <para>ObjEntities may also contain mapping of their lifecycle callback methods.</para>
-    </section>
-    <section xml:id="embeddable">
-        <title>Embeddable</title>
-        <para>Embeddable is a model of a Java class that acts as a single attribute of an ObjEntity,
-            but maps to multiple columns in the database.</para>
-    </section>
-    <section xml:id="procedure">
-        <title>Procedure</title>
-        <para>A model of a stored procedure in the database.</para>
-    </section>
-    <section xml:id="query">
-        <title>Query</title>
-        <para>A model of a query. Cayenne allows queries to be mapped in Cayenne project, or created
-            in the code. Depending on the circumstances the users may take one or the other
-            approach.</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml b/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
deleted file mode 100644
index 4e41174..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="cayennemodeler-application">
-    <title>CayenneModeler Application</title>
-    <section xml:id="working-with-mapping-projects">
-        <title>Working with Mapping Projects</title>
-    </section>
-    <section xml:id="reverse-engineering-database">
-        <title>Reverse Engineering Database</title>
-    </section>
-    <section xml:id="generating-database-schema">
-        <title>Generating Database Schema</title>
-    </section>
-    <section xml:id="migrations">
-        <title>Migrations</title>
-    </section>
-    <section xml:id="generating-java-classes">
-        <title>Generating Java Classes</title>
-    </section>
-    <section xml:id="modeling-inheritance">
-        <title>Modeling Inheritance</title>
-    </section>
-    <section xml:id="modeling-generic-persistence-classes">
-        <title>Modeling Generic Persistent Classes</title>
-        <para>Normally each ObjEntity is mapped to a specific Java class (such as Artist or
-            Painting) that explicitly declare all entity properties as pairs of getters and setters.
-            However Cayenne allows to map a completly generic class to any number of entities. The
-            only expectation is that a generic class implements
-                <emphasis>org.apache.cayenne.DataObject</emphasis>. So an ideal candidate for a
-            generic class is CayenneDataObject, or some custom subclass of CayenneDataObject.</para>
-        <para>If you don't enter anything for Java Class of an ObjEntity, Cayenne assumes generic
-            mapping and uses the following implicit rules to determine a class of a generic object.
-            If DataMap "Custom Superclass" is set, runtime uses this class to instantiate new
-            objects. If not, org.apache.cayenne.CayenneDataObject is used.</para>
-        <para>Class generation procedures (either done in the Modeler or with Ant or Maven) would
-            skip entities that are mapped to CayenneDataObject explicitly or have no class
-            mapping.</para>
-    </section>
-    <section xml:id="mapping-objattributes-to-custom-classes">
-        <title>Mapping ObjAttributes to Custom Classes</title>
-    </section>
-    <section xml:id="modeling-pk-generation-strategy">
-        <title>Modeling Primary Key Generation Strategy</title>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/current-limitations.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/current-limitations.xml b/docs/docbook/cayenne-guide/src/docbkx/current-limitations.xml
deleted file mode 100644
index 4b69324..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/current-limitations.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="current-limitations">
-    <title>Current Limitations</title>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml b/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
deleted file mode 100644
index d8155ee..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
+++ /dev/null
@@ -1,279 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="customizing-cayenne-runtime">
-    <title>Customizing Cayenne Runtime</title>
-    <section xml:id="depdendency-injection-container">
-        <title>Dependency Injection Container</title>
-        <para>Cayenne runtime is built around a small powerful dependency injection (DI) container. Just
-            like other popular DI technologies, such as Spring or Guice, Cayenne DI container
-            manages sets of interdependent objects  and allows users to configure them. These
-            objects are regular Java objects. We are calling them "services" in this document to
-            distinguish from all other objects that are not configured in the container and are not
-            managed. DI container is responsible for service instantiation, injecting correct
-            dependencies, maintaining service instances scope, and dispatching scope events to
-            services. </para>
-        <para>The services are configured in special Java classes called "modules". Each module
-            defines binding of service interfaces to implementation instances, implementation types
-            or providers of implementation instances. There are no XML configuration files, and all
-            the bindings are type-safe. The container supports injection into instance variables and
-            constructor parameters based on the <code>@Inject</code> annotation. This mechanism is
-            very close to Google Guice.</para>
-        <para>The discussion later in this chapter demonstrates a standalone DI container. But keep in
-            mind that Cayenne already has a built-in Injector, and a set of default modules. A
-            Cayenne user would normally only use the API below to write custom extension modules
-            that will be loaded in that existing container when creating ServerRuntime. See
-            "Starting and Stopping ServerRuntime" chapter for an example of passing an extension
-            module to Cayenne.</para>
-        <para>Cayenne DI probably has ~80% of the features expected in a DI container and has no
-            dependency on the rest of Cayenne, so in theory can be used as an application-wide DI
-            engine. But it's primary purpose is still to serve Cayenne. Hence there are no plans to
-            expand it beyond Cayenne needs. It is an ideal "embedded" DI that does not interfere
-            with Spring, Guice or any other such framework present elsewhere in the
-            application.</para>
-        <section xml:id="di-bindings-api">
-            <title>DI Bindings API</title>
-            <para>To have a working DI container, we need three things: service interfaces and
-                classes, a module that describes service bindings, a container that loads the
-                module, and resolves the depedencies. Let's start with service interfaces and
-                classes:<programlisting language="java">public interface Service1 {
-    public String getString();
-}</programlisting><programlisting language="java">public interface Service2 {
-    public int getInt();
-}</programlisting></para>
-            <para>A service implementation using instance variable
-                injection:<programlisting language="java">public class Service1Impl implements Service1 {
-    @Inject
-    private Service2 service2;
-
-    public String getString() {
-        return service2.getInt() + "_Service1Impl";
-    }
-}</programlisting>Same
-                thing, but using constructor
-                injection:<programlisting language="java">public class Service1Impl implements Service1 {
-
-    private Service2 service2;
-
-    public Service1Impl(@Inject Service2 service2) {
-        this.service2 = service2;
-    }
-
-    public String getString() {
-        return service2.getInt() + "_Service1Impl";
-    }
-}
-</programlisting><programlisting language="java">public class Service2Impl implements Service2 {
-    private int i;
-
-    public int getInt() {
-        return i++;
-    }
-}</programlisting></para>
-            <para>Now let's create a module implementing
-                    <code>org.apache.cayenne.tutorial.di.Module</code> interface that will contain
-                DI configuration. A module binds service objects to keys that are reference. Binder
-                provided by container implements fluent API to connect the key to implementation,
-                and to configure various binding options (the options, such as scope, are
-                demonstrated later in this chapter). The simplest form of a key is a Java Class
-                object representing service interface. Here is a module that binds Service1 and
-                Service2 to corresponding default implementations:</para>
-            <para>
-                <programlisting language="java">public class Module1 implements Module {
-
-    public void configure(Binder binder) {
-        binder.bind(Service1.class).to(Service1Impl.class);
-        binder.bind(Service2.class).to(Service2Impl.class);
-    }
-}</programlisting>
-            </para>
-            <para>Once we have at least one module, we can create a DI container.
-                    <code>org.apache.cayenne.di.Injector</code> is the container class in
-                Cayenne:<programlisting language="java">Injector injector = DIBootstrap.createInjector(new Module1());</programlisting></para>
-            <para>Now that we have created the container, we can obtain services from it and call
-                their
-                methods:<programlisting language="java">Service1 s1 = injector.getInstance(Service1.class);
-for (int i = 0; i &lt; 5; i++) {
-    System.out.println("S1 String: " + s1.getString());
-}</programlisting></para>
-            <para>This outputs the following lines, demonstrating that s1 was Service1Impl and
-                Service2 injected into it was
-                Service2Impl:<programlisting language="java">0_Service1Impl
-1_Service1Impl
-2_Service1Impl
-3_Service1Impl
-4_Service1Impl</programlisting></para>
-            <para>There are more flavors of bindings:
-                <programlisting language="java">// binding to instance - allowing user to create and configure instance
-// inside the module class
-binder.bind(Service2.class).toInstance(new Service2Impl());
-
-// binding to provider - delegating instance creation to a special
-// provider class
-binder.bind(Service1.class).toProvider(Service1Provider.class);
-
-// binding to provider instance
-binder.bind(Service1.class).toProviderInstance(new Service1Provider());
-
-// multiple bindings of the same type using Key
-// injection can reference the key name in annotation:
-// @Inject("i1")
-// private Service2 service2;
-binder.bind(Key.get(Service2.class, "i1")).to(Service2Impl.class);
-binder.bind(Key.get(Service2.class, "i2")).to(Service2Impl.class);</programlisting></para>
-            <para>Another types of confiuguration that can be bound in the container are lists and
-                maps. They will be discussed in the following chapters. </para>
-        </section>
-        <section xml:id="managing-services-lifecycle">
-            <title>Service Lifecycle</title>
-            <para>An important feature of the Cayenne DI container is instance <emphasis role="italic"
-                    >scope</emphasis>. The default scope (implicitly used in all examples above) is
-                "singleton", meaning that a binding would result in creation of only one service
-                instance, that will be repeatedly returned from
-                    <code>Injector.getInstance(..)</code>, as well as injected into classes that
-                declare it as a dependency. </para>
-            <para>Singleton scope dispatches a "BeforeScopeEnd" event to interested services. This
-                event occurs before the scope is shutdown, i.e. when
-                    <code>Injector.shutdown()</code> is called. Note that the built-in Cayenne
-                injector is shutdown behind the scenes when <code>ServerRuntime.shutdown()</code>
-                is invoked. Services may register as listeners for this event by annotating a
-                no-argument method with <code>@BeforeScopeEnd</code> annotation. Such method should
-                be implemented if a service needs to clean up some resources, stop threads,
-                etc.</para>
-            <para>Another useful scope is "no scope", meaning that every time a container is asked to provide
-                a service instance for a given key, a new instance will be created and
-                returned:<programlisting language="java">binder.bind(Service2.class).to(Service2Impl.class).withoutScope();</programlisting>Users
-                can also create their own scopes, e.g. a web application request scope or a session
-                scope. Most often than not custom scopes can be created as instances of
-                    <code>org.apache.cayenne.di.spi.DefaultScope</code> with startup and shutdown
-                managed by the application (e.g. singleton scope is a DefaultScope managed by the
-                Injector) . </para>
-        </section>
-        <section xml:id="overriding-services">
-            <title>Overriding Services</title>
-            <para>Cayenne DI allows to override services already definied in the current module, or
-                more commonly - some other module in the the same container. Actually there's no
-                special API to override a service, you'd just bind the service key again with a new
-                implementation or provider. The last binding for a key takes precedence. This means
-                that the order of modules is important when configuring a container. The built-in
-                Cayenne injector ensures that Cayenne standard modules are loaded first, followed by
-                optional user extension modules. This way the application can override the standard
-                services in Cayenne.</para>
-        </section>
-    </section>
-    <section xml:id="ways-to-customize-runtime">
-        <title> Customization Strategies</title>
-        <para>The previous section discussed how Cayenne DI works in general terms. Since Cayenne users
-            will mostly be dealing with an existing Injector provided by ServerRuntime, it is
-            important to understand how to build custom extensions to a preconfigured container. As
-            shown in "Starting and Stopping ServerRuntime" chapter, custom extensions are done by
-            writing an aplication DI module (or multiple modules) that configures service overrides.
-            This section shows all the configuration possibilities in detail, including changing
-            properties of the existing services, contributing services to standard service lists and
-            maps, and overriding service implementations. All the code examples later in this
-            section are assumed to be placed in an application module "configure" method:</para><programlisting>public class MyExtensionsModule implements Module {
-    public void configure(Binder binder) {
-        // customizations go here...
-    }
-}</programlisting><programlisting language="java">Module extensions = new MyExtensionsModule();
-ServerRuntime runtime = 
-    new ServerRuntime("com/example/cayenne-mydomain.xml", extensions);</programlisting>
-        <section xml:id="changing-properties-of-existing-services">
-            <title>Changing Properties of Existing Services</title>
-            <para>Many built-in Cayenne services change their behavior based on a value of some
-                environment property. A user may change Cayenne behavior without even knowing which
-                services are responsible for it, but setting a specific value of a known property.
-                Supported property names are listed in "Appendix A".</para>
-            <para>There are two ways to set service properties. The most obvious one is to pass it
-                to the JVM with -D flag on startup.
-                E.g.<programlisting>java -Dcayenne.server.contexts_sync_strategy=false ...</programlisting></para>
-            <para>A second one is to contribute a property to
-                    <code>org.apache.cayenne.configuration.DefaultRuntimeProperties.properties
-                </code>map (see the next section on how to do that). This map contains the default
-                property values and can accept application-specific values, overrding the defaults. </para>
-            <para>Note that if a property value is a name of a Java class, when this Java class is
-                instantiated by Cayenne, the container performs injection of instance variables. So
-                even the dynamically specified Java classes can use @Inject annotation to get a hold
-                of other Cayenne services.</para>
-            <para>If the same property is specified both in the command line and in the properties
-                map, the command-line value takes precedence. The map value will be ignored. This
-                way Cayenne runtime can be reconfigured during deployment.</para>
-        </section>
-        <section xml:id="contributing-to-service-lists-maps">
-            <title>Contributing to Service Collections</title>
-            <para>Cayenne can be extended by adding custom objects to named maps or lists bound in
-                DI. We are calling these lists/maps "service collections". A service collection
-                allows things like appending a custom strategy to a list of built-in strategies.
-                E.g. an application that needs to install a custom DbAdapter for some database type
-                may contribute an instance of custom DbAdapterDetector to a
-                    <code>org.apache.cayenne.configuration.server.DefaultDbAdapterFactory.detectors</code>
-                list:</para>
-            <programlisting language="java">public class MyDbAdapterDetector implements DbAdapterDetector {
-    public DbAdapter createAdapter(DatabaseMetaData md) throws SQLException {
-        // check if we support this database and retun custom adapter
-        ...
-    }
-}</programlisting>
-            <programlisting language="java">// since build-in list for this key is a singleton, repeated
-// calls to 'bindList' will return the same instance 
-binder.bindList(DefaultDbAdapterFactory.DETECTORS_LIST)
-       .add(MyDbAdapterDetector.class);</programlisting>
-            <para>Maps are customized using a similar "<code>bindMap</code>" method.</para>
-            <para>The names of built-in collections are listed in "Appendix B".</para>
-        </section>
-        <section xml:id="alternative-service-implementations">
-            <title>Alternative Service Implementations</title>
-            <para>As mentioned above, custom modules are loaded by ServerRuntime after the built-in
-                modules. So it is easy to redefine a built-in service in Cayenne by rebinding
-                desired implementations or providers. To do that, first we need to know what those
-                services to redefine are. While we describe some of them in the following sections,
-                the best way to get a full list is to check the source code of the Cayenne version
-                you are using and namely look in
-                    <code>org.apache.cayenne.configuration.server.ServerModule</code> - the main
-                built-in module in Cayenne. </para>
-            <para>Now an example of overriding <code>QueryCache</code> service. The default
-                implementation of this service is provided by <code>MapQueryCacheProvider</code>.
-                But if we want to use <code>EhCacheQueryCache</code> (a Cayenne wrapper for the
-                EhCache framework), we can define it like
-                this:<programlisting language="java">binder.bind(QueryCache.class).to(EhCacheQueryCache.class);</programlisting></para>
-        </section>
-    </section>
-    <section xml:id="noteworthy-runtime-components">
-        <title>Noteworthy Built-in Services</title>
-        <section xml:id="jdbceventlogger">
-            <title>JdbcEventLogger</title>
-            <para><code>org.apache.cayenne.log.JdbcEventLogger</code> is the service that defines
-                logging API for Cayenne internals. It provides facilities for logging queries,
-                commits, transactions, etc. The default implementation is
-                    <code>org.apache.cayenne.log.CommonsJdbcEventLogger</code> that performs logging
-                via commons-logging library. Cayenne library includes another potentially useful
-                logger - <code>org.apache.cayenne.log.FormattedCommonsJdbcEventLogger</code> that
-                produces formatted multiline SQL output that can be easier to read.</para>
-        </section>
-        <section xml:id="datasourcefactory">
-            <title>DataSourceFactory</title>
-        </section>
-        <section xml:id="datachannelfilter">
-            <title>DataChannelFilter</title>
-        </section>
-        <section xml:id="querycache">
-            <title>QueryCache</title>
-        </section>
-        <section xml:id="extendedtypes">
-            <title>ExtendedTypes</title>
-        </section>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/expressions.xml b/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
deleted file mode 100644
index 34257f3..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="expressions">
-    <title>Expressions</title>
-    <section xml:id="expressions-overview">
-        <title>Expressions Overview</title>
-        <para>Cayenne provides a simple yet powerful object-based expression language. The most common
-            usese of expressions are to build qualifiers and orderings of queries that are later
-            converted to SQL by Cayenne and to evaluate in-memory against specific objects (to
-            access certain values in the object graph or to perform in-memory object filtering and
-            sorting). Cayenne provides API to build expressions in the code and a parser to create
-            expressions from strings.</para>
-    </section>
-    <section xml:id="path-expressions">
-        <title>Path Expressions</title>
-        <para>Before discussing how to build expressions, it is important to understand one group of
-            expressions widely used in Cayenne - path expressions. There are two types of path
-            expressions - object and database, used for navigating graphs of connected objects or
-            joined DB tables respectively. Object paths are much more commonly used, as after all
-            Cayenne is supposed to provide a degree of isolation of the object model from the
-            database. However database paths are helpful in certain situations. General structure of
-            path expressions is the following:<programlisting> [db:]segment[+][.segment[+]...]</programlisting><itemizedlist>
-                <listitem>
-                    <para>&quot;db:&quot; is an optional prefix indicating that the following path is a DB
-                        path. Otherwise it is an object path.</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;segment&quot; is a name of a property (relationship or attribute in Cayenne
-                        terms) in the path. Path must have at least one segment; segments are
-                        separated by dot (&quot;.&quot;).</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;+&quot; An &quot;OUTER JOIN&quot; path component. Currently &quot;+&quot; only has effect when
-                        translated to SQL as OUTER JOIN. When evaluating expressions in memory, it
-                        is ignored.</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>An object path expression represents a chain of property names rooted in a certain
-            (unspecified during expression creation) object and &quot;navigating&quot; to its related value.
-            E.g. a path expression &quot;artist.name&quot; might be a property path starting from a Painting
-            object, pointing to the related Artist object, and then to its name attribute. A few
-            more examples:</para>
-        <para>
-            <itemizedlist>
-                <listitem>
-                    <para>&quot;name&quot; - can be used to navigate (read) the &quot;name&quot; property of a Person
-                        (or any other type of object that has a &quot;name&quot; property).</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;artist.exhibits.closingDate&quot; - can be used to navigate to a closing date
-                        of any of the exhibits of a Painting&apos;s Artist object.</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;artist.exhibits+.closingDate&quot; - same as the previous example, but when
-                        translated into SQL, an OUTER JOIN will be used for &quot;exhibits&quot;.</para>
-                </listitem>
-            </itemizedlist>
-        </para>
-        <para>Similarly a database path expression is a dot-separated path through DB table joins
-            and columns. In Cayenne joins are mapped as DbRelationships with some symbolic names
-            (the closest concept to DbRelationship name in the DB world is a named foreign key
-            constraint. But DbRelationship names are usually chosen arbitrarily, without regard to
-            constraints naming or even constraints presence). A database path therefore might look
-            like this -  &quot;db:dbrelationshipX.dbrelationshipY.COLUMN_Z&quot;. More specific examples:<itemizedlist>
-                <listitem>
-                    <para>&quot;db:NAME&quot; - can be used to navigate to the value of &quot;NAME&quot; column of some
-                        unspecified table.</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;db:artist.artistExhibits.exhibit.CLOSING_DATE&quot; - can be used to match a
-                        closing date of any of the exhibits of a related artist record.</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>Cayenne supports &quot;aliases&quot; in path Expressions. E.g. the same expression can be
-            written using explicit path or an alias:<itemizedlist>
-                <listitem>
-                    <para>&quot;artist.exhibits.closingDate&quot; - full path</para>
-                </listitem>
-                <listitem>
-                    <para>&quot;e.closingDate&quot; - alias &quot;e&quot; is used for &quot;artist.exhibits&quot;.</para>
-                </listitem>
-            </itemizedlist>SelectQuery using the second form of the path expression must be made
-            aware of the alias via <emphasis role="italic">
-                &quot;SelectQuery.aliasPathSplits(..)&quot;</emphasis>, otherwise an Exception will be
-            thrown. The main use of aliases is to allow users to control how SQL joins are generated
-            if the same path is encountered more than once in any given Expression. Each alias for
-            any given path would result in a separate join. Without aliases, a single join will be
-            used for a group of matching paths.</para>
-    </section>
-    <section xml:id="expressions-from-strings">
-        <title>Creating Expressions from Strings </title>
-        <para>While in most cases users are likely to rely on API from the following section for
-            expression creation, we&apos;ll start by showing String expressions, as this will help
-            understanding the semantics. A Cayenne expression can be represented as a String, which
-            can be later converted to an expression object using <code>Expression.fromString</code>
-            static method. Here is an
-            example:<programlisting>String expString = &quot;name like &apos;A%&apos; and price &lt; 1000&quot;;
-Expression exp = Expression.fromString(expString);</programlisting>This
-            particular expression may be used to match Paintings with names that start with &quot;A&quot; and
-            a price less than $1000. While this example is pretty self-explanatory, there are a few
-            points worth mentioning. &quot;name&quot; and &quot;price&quot; here are object paths discussed earlier. As
-            always, paths themselves are not attached to a specific root entity and can be applied
-            to any entity that has similarly named attributes or relationships. So when we are
-            saying that this expression &quot;may be used to match Paintings&quot;, we are implying that there
-            may be other entities, for which this expression is valid. Now the expression details... </para>
-        <para><emphasis role="italic">Character constants</emphasis> that are not paths or numeric values
-            should be enclosed in single or double quotes. Two of the expressions below are
-            equivalent:<programlisting>name = &apos;ABC&apos;
-
-// double quotes are escaped inside Java Strings of course
-name = \&quot;ABC\&quot;</programlisting></para>
-        <para><emphasis role="italic">Case sensitivity.</emphasis> Expression operators are all case
-            sensitive and are usually lowercase. Complex words follow the java camel-case
-            style:<programlisting>// valid
-name likeIgnoreCase &apos;A%&apos;
-
-// invalid - will throw a parse exception
-name LIKEIGNORECASE &apos;A%&apos;</programlisting></para>
-        <para><emphasis role="italic">Grouping with parenthesis:</emphasis>
-            <programlisting>value = (price + 250.00) * 3</programlisting>
-        </para>
-        <para><emphasis role="italic">Path prefixes.</emphasis> Object expressions are unquoted strings,
-            optionally prefixed by &quot;obj:&quot; (usually they are not prefixed at all actually). Database
-            expressions are always prefixed with &quot;db:&quot;. A special kind of prefix, not discussed yet
-            is &quot;enum:&quot; that prefixes an enumeration
-            constant:<programlisting>// object path
-name = &apos;Salvador Dali&apos;
-
-// same object path - a rarely used form
-obj:name = &apos;Salvador Dali&apos;
-
-// multi-segment object path
-artist.name = &apos;Salvador Dali&apos;
-
-// db path
-db:NAME = &apos;Salvador Dali&apos;
-
-// enumeration constant
-name = enum:org.foo.EnumClass.VALUE1</programlisting></para>
-        <para>
-            <emphasis role="italic">Binary conditions</emphasis> are expressions that contain a path
-            on the left, a value on the right, and some operation between them, such as equals,
-            like, etc. They can be used as qualifiers in
-                SelectQueries:<programlisting>name like &apos;A%&apos;</programlisting>
-            <emphasis role="italic">Named parameters.</emphasis> Expressions can have named parameters (names that
-            start with &quot;$&quot;). Parameterized expressions allow to create reusable expression
-            templates. Also if an Expression contains a complex object that doesn&apos;t have a simple
-            String representation (e.g. a Date, a DataObject, an ObjectId), parameterizing such
-            expression is the only way to represent it as String. Here are some
-            examples:<programlisting>Expression template = Expression.fromString(&quot;name = $name&quot;);
-...
-Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador Dali&quot;);
-Expression qualifier1 = template.expWithParameters(p1);
-...
-Map p2 = Collections.singletonMap(&quot;name&quot;, &quot;Monet&quot;);
-Expression qualifier2 = template.expWithParameters(p2);</programlisting>To
-            create a named parameterized expression with a LIKE clause, SQL wildcards must be part
-            of the values in the Map and not the expression string
-            itself:<programlisting>Expression template = Expression.fromString(&quot;name like $name&quot;);
-...
-Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador%&quot;);
-Expression qualifier1 = template.expWithParameters(p1);</programlisting>When
-            matching on a relationship, parameters can be Persistent objects or
-            ObjectIds:<programlisting>Expression template = Expression.fromString(&quot;artist = $artist&quot;);
-...
-Artist dali = // asume we fetched this one already
-Map p1 = Collections.singletonMap(&quot;artist&quot;, dali);
-Expression qualifier1 = template.expWithParameters(p1);</programlisting>Uninitialized
-            parameters will be automatically pruned from expressions, so a user can omit some
-            parameters when creating an expression from a parameterized
-            template:<programlisting>Expression template = Expression.fromString(&quot;name like $name and dateOfBirth &gt; $date&quot;);
-...
-Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador%&quot;);
-Expression qualifier1 = template.expWithParameters(p1);
-
-// qualifier1 is now equals to &quot;name like &apos;Salvador%&apos;&quot;, the &apos;dateOfBirth&apos; condition was
-// pruned, as no value was specified for the $date parameter</programlisting></para>
-        <para><emphasis role="italic">Null handling.</emphasis> Handling of Java nulls as operands
-            is no different from normal values. Instead of using special conditional operators, like
-            SQL does (IS NULL, IS NOT NULL), &quot;=&quot; and &quot;!=&quot; expressions can be used directly with null
-            values. It is up to Cayenne to translate expressions with nulls to the valid SQL.</para>
-        <para>
-            <note>
-                <para>A formal definition of all possible valid expressions in a form of JavaCC
-                    grammar is provided in Appendix C</para>
-            </note>
-        </para>
-    </section>
-    <section xml:id="expressions-with-expressionfactory">
-        <title>Creating Expressions with API</title>
-        <para>Creating expressions from Strings is a powerful and dynamic approach, however a safer
-            alternative is to use Java API. It provides some degree of compile-time checking of
-            expressions validity. The API is cenetred around ExpressionFactory class, and the
-            Expression class. ExpressionFactory contains a number of rather self-explanatory factory
-            methods. We won&apos;t be going over all of them in detail, but will rather show a few
-            general examples and some gotchas. </para>
-        <para>The following code recreates the expression from the previous chapter, but now using
-            expression
-            API:<programlisting>// String expression: name like &apos;A%&apos; and price &lt; 1000
-Expression e1 = ExpressionFactory.likeExp(Painting.NAME_PROPERTY, &quot;A%&quot;);
-Expression e2 = ExpressionFactory.lessExp(Painting.PRICE_PROPERTY, 1000);
-Expression finalExp = e1.andExp(e2); </programlisting>This
-            is more verbose than creating it from String, but it is also more resilient to the
-            entity properties renaming and precludes semantic errors in the expression String.<note>
-                <para>The last line in the example above shows how to create a new expression by
-                    &quot;chaining&quot; 2 other epxressions. A common error when chaining expressions is to
-                    assume that &quot;andExp&quot; and &quot;orExp&quot; append another expression to the current
-                    expression. In fact a new expression is created. I.e. Expression API treats
-                    existing expressions as immutable.</para>
-            </note></para>
-        <para>As discussed earlier, Cayenne supports aliases in path Expressions, allowing to
-            control how SQL joins are generated if the same path is encountered more than once in
-            the same Expression. Two ExpressionFactory methods allow to implicitly generate aliases
-            to &quot;split&quot; match paths into individual joins if
-            needed:<programlisting>Expression matchAllExp(String path, Collection values)
-Expression matchAllExp(String path, Object... values)</programlisting></para>
-        <para>&quot;Path&quot; argument to both of these methods can use a split character (a pipe symbol &apos;|&apos;)
-            instead of dot to indicate that relationship following a path should be split into a
-            separate set of joins, one per collection value. There can only be one split at most in
-            any given path. Split must always precede a relationship. E.g. &quot;|exhibits.paintings&quot;,
-            &quot;exhibits|paintings&quot;, etc. Internally Cayenne would generate distinct aliases for each
-            of the split expressions, forcing separate joins.</para>
-    </section>
-    <section xml:id="expressions-in-memory">
-        <title>Evaluating Expressions in Memory</title>
-        <para>When used in a query, an expression is converted to SQL WHERE clause (or ORDER BY
-            clause) by Cayenne during query execution. Thus the actual evaluation against the data
-            is done by the database engine. However the same expressions can also be used for
-            accessing object properties, calculating values, in-memory filtering. </para>
-        <para>Checking whether an object satisfies an
-            expression:<programlisting>Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
-User user = ...
-if(e.match(user)) {
-   ...
-}</programlisting>Reading
-            property
-            value:<programlisting>Expression e = Expression.fromString(User.NAME_PROPERTY);
-String name = e.evaluate(user);</programlisting></para>
-        <para>Filtering a list of
-            objects:<programlisting>Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
-List&lt;User&gt; unfiltered = ...
-List&lt;User&gt; filtered = e.filterObjects(unfiltered);</programlisting></para>
-        <para>
-            <note>
-                <para>Current limitation of in-memory expressions is that no collections are
-                    permitted in the property path.</para>
-            </note>
-        </para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-client.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-client.xml b/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-client.xml
deleted file mode 100644
index a95a0fd..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-client.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="implementing-rop-client">
-    <title>Implementing ROP Client</title>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-server.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-server.xml b/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-server.xml
deleted file mode 100644
index 3032fd1..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/implementing-rop-server.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="implementing-rop-server">
-    <title>Implementing ROP Server</title>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml b/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
deleted file mode 100644
index 359bef9..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
+++ /dev/null
@@ -1,546 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="including-cayenne-in-project">
-    <title>Including Cayenne in a Project</title>
-    <section xml:id="jar-files-and-depdendencies">
-        <title>Jar Files and Dependencies</title>
-        <para>Cayenne distribution contains the following core runtime jars in the distribution
-                <code>lib</code> directory: <itemizedlist>
-                <listitem>
-                    <para><emphasis role="italic">cayenne-server-x.x.jar</emphasis> - contains full
-                        Cayenne runtime (DI, adapters, DB access classes, etc.). Most applications
-                        will use only this file.</para>
-                </listitem>
-                <listitem>
-                    <para>cayenne-client-x.x.jar - a subset of cayenne-server.jar trimmed for use on
-                        the client in an ROP application.</para>
-                </listitem>
-                <listitem>
-                    <para>Other cayenne-* jars - various Cayenne extensions.</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>When using <code>cayenne-server-x.x.jar</code> you'll need a few third party jars (all
-            included in <code>lib/third-party</code> directory of the distribution): <itemizedlist>
-                <listitem>
-                    <para><link xlink:href="http://velocity.apache.org/">Apache Velocity
-                            Template Engine</link>, version 1.6.x (and all its dependencies bundled
-                        with velocity-dep)</para>
-                </listitem>
-                <listitem>
-                    <para><link xlink:href="http://commons.apache.org/collections/">Apache Commons
-                            Collections</link>, version 3.2.1</para>
-                </listitem>
-                <listitem>
-                    <para><link xlink:href="http://commons.apache.org/logging/">Apache
-                            Commons Logging</link>, version 1.1</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>Cayenne integrates with various caching, clustering and other frameworks. These
-            optional integrations will require other third-party jars that the users will need to
-            obtain on their own.</para>
-    </section>
-    <section xml:id="maven-projects">
-        <title>Maven Projects</title>
-        <para>If you are using Maven, you won't have to deal with figuring out the dependencies. You
-            can simply include cayenne-server artifact in your
-            POM:<programlisting>&lt;dependency>
-   &lt;groupId>org.apache.cayenne&lt;/groupId>
-   &lt;artifactId>cayenne-server&lt;/artifactId>
-   &lt;version>X.Y.Z&lt;/version>
-&lt;/dependency></programlisting></para>
-        <para>Additionally Cayenne provides a Maven plugin with a set of goals to perform various project
-            tasks, such as synching generated Java classes with the mapping, described in the
-            following subsection. The full plugin name is
-                <code>org.apache.cayenne.plugins:maven-cayenne-plugin</code>.</para>
-        <section xml:id="mvn-cgen">
-            <title>cgen</title>
-            <para><code>cgen</code> is a <code>maven-cayenne-plugin</code> goal that generates and maintains
-                source (.java) files of persistent objects based on a DataMap. By default, it is
-                bound to the generate-sources phase. If "makePairs" is set to "true" (which is the
-                recommended default), this task will generate a pair of classes
-                (superclass/subclass) for each ObjEntity in the DataMap. Superclasses should not be
-                changed manually, since they are always overwritten. Subclasses are never
-                overwritten and may be later customized by the user. If "makePairs" is set to
-                "false", a single class will be generated for each ObjEntity. </para>
-            <para>By creating custom templates, you can use cgen to generate other output (such as
-                web pages, reports, specialized code templates) based on DataMap information.</para>
-            <para>
-                <table frame="void">
-                    <caption>cgen required parameters</caption>
-                    <col width="14%"/>
-                    <col width="6%"/>
-                    <col width="80%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>map</code>
-                            </td>
-                            <td>File</td>
-                            <td>DataMap XML file which serves as a source of metadata for class
-                                generation. E.g.
-                                    <code>${project.basedir}/src/main/resources/my.map.xml</code></td>
-                        </tr>
-                        <tr>
-                            <td><code>destDir</code></td>
-                            <td>File</td>
-                            <td>Root destination directory for Java classes (ignoring their package
-                                names).</td>
-                        </tr>
-                    </tbody>
-                </table>
-                <table frame="void">
-                    <caption>cgen optional parameters</caption>
-                    <col width="33%"/>
-                    <col width="8%"/>
-                    <col width="59%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>additionalMaps</code>
-                            </td>
-                            <td>File</td>
-                            <td>A directory that contains additional DataMap XML files that may be
-                                needed to resolve cross-DataMap relationships for the the main
-                                DataMap, for which class generation occurs.</td>
-                        </tr>
-                        <tr>
-                            <td><code>client</code></td>
-                            <td>boolean</td>
-                            <td>Whether we are generating classes for the client tier in a Remote
-                                Object Persistence application. "False" by default.</td>
-                        </tr>
-                        <tr>
-                            <td><code>embeddableTemplate</code></td>
-                            <td>String</td>
-                            <td>Location of a custom Velocity template file for Embeddable class
-                                generation. If omitted, default template is used.</td>
-                        </tr>
-                        <tr>
-                            <td><code>embeddableSuperTemplate</code></td>
-                            <td>String</td>
-                            <td>Location of a custom Velocity template file for Embeddable
-                                superclass generation. Ignored unless "makepairs" set to "true". If
-                                omitted, default template is used.</td>
-                        </tr>
-                        <tr>
-                            <td><code>encoding</code></td>
-                            <td>String</td>
-                            <td>Generated files encoding if different from the default on current
-                                platform. Target encoding must be supported by the JVM running the
-                                build. Standard encodings supported by Java on all platforms are
-                                US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16. See
-                                javadocs for java.nio.charset.Charset for more information.</td>
-                        </tr>
-                        <tr>
-                            <td><code>excludeEntities</code></td>
-                            <td>String</td>
-                            <td>A comma-separated list of ObjEntity patterns (expressed as a perl5
-                                regex) to exclude from template generation. By default none of the
-                                DataMap entities are excluded.</td>
-                        </tr>
-                        <tr>
-                            <td><code>includeEntities</code></td>
-                            <td>String</td>
-                            <td>A comma-separated list of ObjEntity patterns (expressed as a perl5
-                                regex) to include from template generation. By default all DataMap
-                                entities are included.</td>
-                        </tr>
-                        <tr>
-                            <td><code>makePairs</code></td>
-                            <td>boolean</td>
-                            <td>If "true" (a recommended default), will generate subclass/superclass
-                                pairs, with all generated code placed in superclass.</td>
-                        </tr>
-                        <tr>
-                            <td><code>mode</code></td>
-                            <td>String</td>
-                            <td>Specifies class generator iteration target. There are three possible
-                                values: "entity" (default), "datamap", "all". "entity" performs one
-                                generator iteration for each included ObjEntity, applying either
-                                standard to custom entity templates. "datamap" performs a single
-                                iteration, applying DataMap templates. "All" is a combination of
-                                entity and datamap.</td>
-                        </tr>
-                        <tr>
-                            <td><code>overwrite</code></td>
-                            <td>boolean</td>
-                            <td>Only has effect when "makePairs" is set to "false". If "overwrite"
-                                os "true", will overwrite older versions of generated classes.</td>
-                        </tr>
-                        <tr>
-                            <td><code>superPkg</code></td>
-                            <td>String</td>
-                            <td>Java package name of generated superclasses. Only has effect if
-                                "makepairs" and "usePkgPath" are set to "true" (both are true by
-                                default). Defines a common package for all generated Java classes.
-                                If omitted, each superclass will be placed in the same package as
-                                subclass.</td>
-                        </tr>
-                        <tr>
-                            <td><code>superTemplate</code></td>
-                            <td>String</td>
-                            <td>Location of a custom Velocity template file for ObjEntity superclass
-                                generation. Only has effect if "makepairs" set to "true". If
-                                omitted, default template is used.</td>
-                        </tr>
-                        <tr>
-                            <td><code>template</code></td>
-                            <td>String</td>
-                            <td>Location of a custom Velocity template file for ObjEntity class
-                                generation. If omitted, default template is used.</td>
-                        </tr>
-                        <tr>
-                            <td><code>usePkgPath</code></td>
-                            <td>boolean</td>
-                            <td>If set to "true" (default), a directory tree will be generated in
-                                "destDir" corresponding to the class package structure, if set to
-                                "false", classes will be generated in "destDir" ignoring their
-                                package.</td>
-                        </tr>
-                    </tbody>
-                </table>
-                Example - a typical class generation scenario, where pairs of classes are
-                generated, and superclasses are placed in a separate package:
-                <programlisting>&lt;plugin>
-    &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
-    &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
-
-    &lt;!--
-    There's an intermittent problem when using Maven/cgen in Eclipse with  m2eclipse plugin that
-    requires placing "configuration" section at the plugin level, instead of execution
-    level.
-    -->
-    &lt;configuration>
-        &lt;map>${project.basedir}/src/main/resources/my.map.xml&lt;/map>
-        &lt;destDir>${project.basedir}/src/main/java&lt;/destDir>
-        &lt;superPkg>org.example.model.auto&lt;/superPkg>
-    &lt;/configuration>
-
-    &lt;executions>
-        &lt;execution>
-            &lt;goals>
-                &lt;goal>cgen&lt;/goal>
-            &lt;/goals>
-        &lt;/execution>
-    &lt;/executions>
-&lt;/plugin></programlisting></para>
-        </section>
-        <section xml:id="mvn-cdbgen">
-            <title>cdbgen</title>
-            <para><code>cdbgen</code> is a <code>maven-cayenne-plugin</code> goal that drops and/or generates
-                tables in a database on Cayenne DataMap. By default, it is bound to the
-                pre-integration-test phase.<table frame="void">
-                    <caption>cdbgen required parameters</caption>
-                    <col width="14%"/>
-                    <col width="10%"/>
-                    <col width="76%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>map</code>
-                            </td>
-                            <td>File</td>
-                            <td>DataMap XML file which serves as a source of metadata for DB schema
-                                generation. E.g.
-                                    <code>${project.basedir}/src/main/resources/my.map.xml</code></td>
-                        </tr>
-                        <tr>
-                            <td><code>driver</code></td>
-                            <td>String</td>
-                            <td>A class of JDBC driver to use for the target database.</td>
-                        </tr>
-                        <tr>
-                            <td><code>url</code></td>
-                            <td>String</td>
-                            <td>JDBC connection URL of a target database.</td>
-                        </tr>
-                    </tbody>
-                </table></para>
-            <para>
-                <table frame="void">
-                    <caption>cdbgen optional parameters</caption>
-                    <col width="18%"/>
-                    <col width="11%"/>
-                    <col width="75%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>adapter</code>
-                            </td>
-                            <td>String</td>
-                            <td>Java class name implementing org.apache.cayenne.dba.DbAdapter. While
-                                this attribute is optional (a generic JdbcAdapter is used if not
-                                set), it is highly recommended to specify correct target
-                                adapter.</td>
-                        </tr>
-                        <tr>
-                            <td><code>createFK</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether cdbgen should create foreign key constraints. Default is "true".</td>
-                        </tr>
-                        <tr>
-                            <td><code>createPK</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether cdbgen should create Cayenne-specific auto PK objects. Default is
-                                "true".</td>
-                        </tr>
-                        <tr>
-                            <td><code>createTables</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether cdbgen should create new tables. Default is "true".</td>
-                        </tr>
-                        <tr>
-                            <td><code>dropPK</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether cdbgen should drop Cayenne primary key support objects. Default is
-                                "false".</td>
-                        </tr>
-                        <tr>
-                            <td><code>dropTables</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether cdbgen should drop the tables before attempting to create new ones.
-                                Default is "false".</td>
-                        </tr>
-                        <tr>
-                            <td><code>password</code></td>
-                            <td>String</td>
-                            <td>Database user password.</td>
-                        </tr>
-                        <tr>
-                            <td><code>username</code></td>
-                            <td>String</td>
-                            <td>Database user name.</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </para>
-            <para>Example - creating a DB schema on a local HSQLDB
-                database:<programlisting>&lt;plugin>
-    &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
-    &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
-
-    &lt;executions>
-        &lt;execution>
-            &lt;configuration>
-                &lt;map>${project.basedir}/src/main/resources/my.map.xml&lt;/map>
-                &lt;url>jdbc:hsqldb:hsql://localhost/testdb&lt;/url>
-                &lt;adapter>org.apache.cayenne.dba.hsqldb.HSQLDBAdapter&lt;/adapter>
-                &lt;driver>org.hsqldb.jdbcDriver&lt;/driver>
-                &lt;username>sa&lt;/username>
-            &lt;/configuration>
-            &lt;goals>
-                &lt;goal>cdbgen&lt;/goal>
-            &lt;/goals>
-        &lt;/execution>
-    &lt;/executions>
-&lt;/plugin></programlisting></para>
-        </section>
-        <section xml:id="mvn-cdbimport">
-            <title>cdbimport</title>
-            <para><code>cdbimport</code> is a <code>maven-cayenne-plugin</code> goal that generates
-                a DataMap based on an existing database schema. By default, it is bound to the
-                generate-sources phase. This allows you to generate your DataMap prior to building
-                your project, which may be necessary if you are also using the cgen task.<table
-                    frame="void">
-                    <caption>cdbimport required parameters</caption>
-                    <col width="14%"/>
-                    <col width="10%"/>
-                    <col width="76%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>map</code>
-                            </td>
-                            <td>File</td>
-                            <td>DataMap XML file which is the destination of the schema import.
-                                Maybe an existing file. If this file does not exist, it is created
-                                when cdbimport is executed. E.g.
-                                    <code>${project.basedir}/src/main/resources/my.map.xml</code></td>
-                        </tr>
-                        <tr>
-                            <td><code>driver</code></td>
-                            <td>String</td>
-                            <td>A class of JDBC driver to use for the target database.</td>
-                        </tr>
-                        <tr>
-                            <td><code>url</code></td>
-                            <td>String</td>
-                            <td>JDBC connection URL of a target database.</td>
-                        </tr>
-                    </tbody>
-                </table></para>
-            <para>
-                <table frame="void">
-                    <caption>cdbimport optional parameters</caption>
-                    <col width="25%"/>
-                    <col width="10%"/>
-                    <col width="65%"/>
-                    <thead>
-                        <tr>
-                            <th>Name</th>
-                            <th>Type</th>
-                            <th>Description</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><code>adapter</code>
-                            </td>
-                            <td>String</td>
-                            <td>Java class name implementing org.apache.cayenne.dba.DbAdapter. While
-                                this attribute is optional (a generic JdbcAdapter is used if not
-                                set), it is highly recommended to specify correct target
-                                adapter.</td>
-                        </tr>
-                        <tr>
-                            <td><code>importProcedures</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether stored procedures should be imported from the
-                                database. Default is false. </td>
-                        </tr>
-                        <tr>
-                            <td><code>meaningfulPk</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether primary keys should be mapped as attributes of the
-                                ObjEntity. Default is false. </td>
-                        </tr>
-                        <tr>
-                            <td><code>namingStrategy</code></td>
-                            <td>String</td>
-                            <td>The naming strategy used for mapping database names to object entity
-                                names. Default is
-                                    <code>org.apache.cayenne.map.naming.SmartNamingStrategy</code>.
-                            </td>
-                        </tr>
-                        <tr>
-                            <td><code>overwriteExisting</code></td>
-                            <td>boolean</td>
-                            <td>Indicates whether existing DB and object entities should be
-                                overwritten. This is an all-or-nothing setting. If you need finer
-                                granularity, use the CayenneModeler. Default is "true". </td>
-                        </tr>
-                        <tr>
-                            <td><code>password</code></td>
-                            <td>String</td>
-                            <td>Database user password.</td>
-                        </tr>
-                        <tr>
-                            <td><code>procedurePattern</code></td>
-                            <td>String</td>
-                            <td>Pattern to match stored procedure names against for import. Default
-                                is to match all stored procedures. This value is only meaningful if
-                                importProcedures is true. </td>
-                        </tr>
-                        <tr>
-                            <td><code>schemaName</code></td>
-                            <td>String</td>
-                            <td>Database schema to import tables/stored procedures from. </td>
-                        </tr>
-                        <tr>
-                            <td><code>tablePattern</code></td>
-                            <td>String</td>
-                            <td>Pattern to match table names against for import. Default is to match
-                                all tables. </td>
-                        </tr>
-                        <tr>
-                            <td><code>username</code></td>
-                            <td>String</td>
-                            <td>Database user name.</td>
-                        </tr>
-                    </tbody>
-                </table>
-            </para>
-            <para>Example - loading a DB schema from a local HSQLDB database (essentially a reverse operation
-                compared to the cdbgen example above)
-                :<programlisting>&lt;plugin>
-    &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
-    &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
-
-    &lt;executions>
-        &lt;execution>
-            &lt;configuration>
-                &lt;map>${project.basedir}/src/main/resources/my.map.xml&lt;/map>
-                &lt;url>jdbc:mysql://127.0.0.1/mydb&lt;/url>
-                &lt;adapter>org.apache.cayenne.dba.hsqldb.HSQLDBAdapter&lt;/adapter>
-                &lt;driver>com.mysql.jdbc.Driver&lt;/driver>
-                &lt;username>sa&lt;/username>
-            &lt;/configuration>
-            &lt;goals>
-                &lt;goal>cdbimport&lt;/goal>
-            &lt;/goals>
-        &lt;/execution>
-    &lt;/executions>
-&lt;/plugin></programlisting></para>
-        </section>
-    </section>
-    <section xml:id="ant-projects">
-        <title>Ant Projects</title>
-        <section xml:id="ant-cgen">
-            <title>cgen</title>
-        </section>
-        <section xml:id="ant-cdbgen">
-            <title>cdbgen</title>
-        </section>
-        <section xml:id="ant-cdbimport">
-            <title>cdbimport</title>
-            <para>This is an Ant counterpart of "cdbimport" goal of maven-cayenne-plugin described
-                above. It has exactly the same properties. Here is a usage
-                example:<programlisting> &lt;cdbimport map="${context.dir}/WEB-INF/my.map.xml"
-    driver="com.mysql.jdbc.Driver" 
-    url="jdbc:mysql://127.0.0.1/mydb" 
-    username="sa"/> </programlisting>
-            </para>
-        </section>
-        <section xml:id="ant-cdataport">
-            <title>cdataport</title>
-        </section>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/index.xml b/docs/docbook/cayenne-guide/src/docbkx/index.xml
deleted file mode 100644
index 0e850e8..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/index.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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.
--->
-<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="cayenne-guide" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <info>
-        <title>Cayenne Guide</title>
-        <copyright>
-            <year>2011-2017</year>
-            <holder>Apache Software Foundation and individual authors</holder>
-        </copyright>
-        <legalnotice>
-            <title>License</title>
-            <para>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</para>
-
-            <para>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.</para>
-        </legalnotice>
-    </info>
-    <xi:include href="part1.xml"/>
-    <xi:include href="part2.xml"/>
-    <xi:include href="part3.xml"/>
-    <xi:include href="appendix-a.xml"/>
-    <xi:include href="appendix-b.xml"/>
-    <xi:include href="appendix-c.xml"/>
-</book>


[04/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/queries.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/queries.xml b/docs/docbook/cayenne-guide/src/docbkx/queries.xml
deleted file mode 100644
index dfbad2f..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/queries.xml
+++ /dev/null
@@ -1,628 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="queries">
-    <title>Queries</title>
-    <para>Queries are Java objects used by the application to communicate with the database. Cayenne
-        knows how to translate queries into SQL statements appropriate for a particular database
-        engine. Most often queries are used to find objects matching certain criteria, but there are
-        other types of queries too. E.g. those allowing to run native SQL, call DB stored
-        procedures, etc. When committing objects, Cayenne itself creates special queries to
-        insert/update/delete rows in the dabase.</para>
-    <para>There is a number of built-in queries in Cayenne, described later in this chapter. Users can
-        also define their own query types to abstract certain DB interactions that for whatever
-        reason can not be adequately described by the built-in set. </para>
-    <para>Queries can be roughly categorized as "object" and "native". Object queries (most notably
-        SelectQuery and EJBQLQuery) are built with abstractions originating in the object model (the
-        "object" side in the "object-relational" divide). E.g. SelectQuery is assembled from a Java
-        class of the objects to fetch, a qualifier expression, orderings, etc. - all of this
-        expressed in terms of the object model.</para>
-    <para>Native queries describe a desired DB operation as SQL code (SQLTemplate query) or a
-        reference to a stored procedure (ProcedureQuery), etc. The results of native queries are
-        usually presented as Lists of Maps, with each map representing a row in the DB (a term "data
-        row" is often used to describe such a map). They can potentially be converted to objects,
-        however it may take a considerable effort to do so. Native queries are also less (if at all)
-        portable across databases than object queries. </para>
-    <section xml:id="selectquery">
-        <title>SelectQuery</title>
-        <para>SelectQuery is the most commonly used query in user applications. This may be the only
-            query you will need in most appplications. It returns a list of persistent objects of a
-            certain type specified in the
-            query:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-List&lt;Artist> objects = context.performQuery(query);</programlisting>This
-            returned all rows in the "ARTIST" table. If the logs were turned on, you might see the
-            following SQL
-            printed:<programlisting language="java">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
-INFO: === returned 5 row. - took 5 ms.</programlisting></para>
-        <para>This SQL was generated by Cayenne from the SelectQuery above. SelectQuery can have a
-            qualifier to select only the data that you care about. Qualifier is simply an Expression
-            (Expressions where discussed in the previous chapter). If you only want artists whose
-            name begins with 'Pablo', you might use the following qualifier expression:
-            <programlisting language="java">SelectQuery query = new SelectQuery(Artist.class, 
-        ExpressionFactory.likeExp(Artist.NAME_PROPERTY, "Pablo%"));
-List&lt;Artist> objects = context.performQuery(query);</programlisting>The
-            SQL will look different this
-            time:<programlisting language="java">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
-[bind: 1->NAME:'Pablo%']
-INFO: === returned 1 row. - took 6 ms.</programlisting></para>
-        <para>SelectQuery allows to append parts of qualifier to
-            self:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-query.setQualifier(ExpressionFactory.likeExp(Artist.NAME_PROPERTY, "A%"));
-query.andQualifier(ExpressionFactory.greaterExp(Artist.DATE_OF_BIRTH_PROPERTY, someDate));</programlisting></para>
-        <para>To order the results of SelectQuery, one or more Orderings can be applied. Ordering
-            were already discussed earlier.
-            E.g.:<programlisting language="java">SelectQuery query = new SelectQuery(Artist.class);
-
-// create Ordering object explicitly
-query.addOrdering(new Ordering(Artist.DATE_OF_BIRTH_PROPERTY, SortOrder.DESCENDING));
-
-// or let SelectQuery create it behind the scenes
-query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);</programlisting></para>
-        <para>There's a number of other useful properties in SelectQuery that define what to select
-            and how to optimize database interaction (prefetching, caching, fetch offset and limit,
-            pagination, etc.). Some of them are discussed in separate chapters on caching and
-            performance optimization. Others are fairly self-explanatory. Please check the API docs
-            for the full extent of the SelectQuery features.</para>
-    </section>
-    <section xml:id="ejbqlquery">
-        <title>EJBQLQuery</title>
-        <para>EJBQLQuery was created as a part of an experiment in adopting some of Java Persistence
-            API (JPA) approaches in Cayenne. It is a parameterized object query that is created from
-            query String. A String used to build EJBQLQuery must conform to JPQL (JPA query
-            language):<programlisting language="java">EJBQLQuery query = new EJBQLQuery("select a FROM Artist a");</programlisting></para>
-        <para>JPQL details can be found in any JPA manual. Here we'll mention only how this fits
-            into Cayenne and what are the differences between EJBQL and other Cayenne
-            queries.</para>
-        <para>Although most frequently EJBQLQuery is used as an alternative to SelectQuery, there
-            are also DELETE and UPDATE varieties available. <note>
-                <para>As of this version of Cayenne, DELETE and UPDATE do not change the state of
-                    objects in the ObjectContext. They are run directly against the database
-                    instead. </para>
-            </note><programlisting language="java">EJBQLQuery select = new EJBQLQuery("select a FROM Artist a WHERE a.name = 'Salvador Dali'");
-List&lt;Artist> artists = context.performQuery(select);</programlisting><programlisting language="java">EJBQLQuery delete = new EJBQLQuery("delete from Painting");
-context.performGenericQuery(delete);</programlisting><programlisting language="java">EJBQLQuery update = new EJBQLQuery("UPDATE Painting AS p SET p.name = 'P2' WHERE p.name = 'P1'");
-context.performGenericQuery(update);</programlisting>In
-            most cases SelectQuery is preferred to EJBQLQuery, as it is API-based, and provides you
-            with better compile-time checks. However sometimes you may want a completely scriptable
-            object query. This is when you might prefer EJBQL. A more practical reason for picking
-            EJBQL over SelectQuery though is that the former offers some extra selecting
-            capabilities, namely aggregate functions and
-            subqueries:<programlisting language="java">EJBQLQuery query = new EJBQLQuery("select a, COUNT(p) FROM Artist a JOIN a.paintings p GROUP BY a");
-List&lt;Object[]> result = context.performQuery(query);
-for(Object[] artistWithCount : result) {
-    Artist a = (Artist) artistWithCount[0];
-    int hasPaintings = (Integer) artistWithCount[1];
-}</programlisting>This
-            also demonstrates a previously unseen type of select result - a List of Object[]
-            elements, where each entry in an Object[] is either a DataObject or a scalar, depending
-            on the query SELECT clause. A result can also be a list of
-            scalars:<programlisting language="java">EJBQLQuery query = new EJBQLQuery("select a.name FROM Artist a");
-List&lt;String> names = context.performQuery(query);</programlisting>While
-            Cayenne Expressions discussed previously can be thought of as identical to JPQL WHERE
-            clause, and indeed they are very close, there are a few noteable differences:<itemizedlist>
-                <listitem>
-                    <para>Null handling: SelectQuery would translate the expressions matching NULL
-                        values to the corresponding "X IS NULL" or "X IS NOT NULL" SQL syntax.
-                        EJBQLQuery on the other hand requires explicit "IS NULL" (or "IS NOT NULL")
-                        syntax to be used, otherwise the generated SQL will look like "X = NULL" (or
-                        "X &lt;> NULL"), which will evaluate differently.</para>
-                </listitem>
-                <listitem>
-                    <para>Expression Parameters: SelectQuery uses "$" to denote named parameters
-                        (e.g. "$myParam"), while EJBQL uses ":" (e.g. ":myParam"). Also EJBQL
-                        supports positional parameters denoted by the question mark: "?3".</para>
-                </listitem>
-            </itemizedlist></para>
-    </section>
-    <section xml:id="sqltemplate">
-        <title>SQLTemplate</title>
-        <para>SQLTemplate is a query that allows to run native SQL from a Cayenne application. It
-            comes handy when the standard ORM concepts are not sufficient for a given query or an
-            update. SQL is too powerful and allows to manipulate data in ways that are not easily
-            described as a graph of related entities. Cayenne acknowledges this fact and provides
-            this facility to execute SQL, mapping the result to objects when possible. Here are
-            examples of selecting and non-selecting
-            SQLTemplates:<programlisting language="java">SQLTemplate select = new SQLTemplate(Artist.class, "select * from ARTIST"); 
-List&lt;Artist> result = context.performQuery(select);</programlisting><programlisting language="java">SQLTemplate update = new SQLTemplate(Artist.class, "delete from ARTIST");
-QueryResponse response = context.performGenericQuery(update);</programlisting></para>
-        <para>Cayenne doesn't make any attempt to make sense of the SQL semantics, so it doesn't
-            know whether a given query is performing a select or update, etc. It is the the user's
-            decision to run a given query as a selecting or "generic".</para>
-        <para>
-            <note>
-                <para>Any data modifications done to DB as a result of SQLTemplate execution do not
-                    change the state of objects in the ObjectContext. So some objects in the context
-                    may become stale as a result.</para>
-            </note>
-        </para>
-        <para>Another point to note is that the first argument to the SQLTemplate constructor - the
-            Java class - has the same meaning as in SelectQuery only when the result can be
-            converted to objects (e.g. when this is a selecting query and it is selecting all
-            columns from one table). In this case it denotes the "root" entity of this query result.
-            If the query does not denote a single entity result, this argument is only used for
-            query routing, i.e. determining which database it should be run against. You are free to
-            use any persistent class or even a DataMap instance in such situation. It will work as
-            long as the passed "root" maps to the same database as the current query.</para>
-        <para>To achieve interoperability between mutliple RDBMS a user can specify multiple SQL
-            statements for the same SQLTemplate, each corresponding to a native SQL dialect. A key
-            used to look up the right dialect during execution is a fully qualified class name of
-            the corresponding DbAdapter. If no DB-specific statement is present for a given DB, a
-            default generic statement is used. E.g. in all the examples above a default statement
-            will be used regardless of the runtime database. So in most cases you won't need to
-            explicitly "translate" your SQL to all possible dialects. Here is how this works in
-            practice:<programlisting language="java">SQLTemplate select = new SQLTemplate(Artist.class, "select * from ARTIST"); 
-
-// For Postgres it would be nice to trim padding of all CHAR columns.
-// Otherwise those will be returned with whitespace on the right.
-// assuming "NAME" is defined as CHAR...
-String pgSQL = "SELECT ARTIST_ID, RTRIM(NAME), DATE_OF_BIRTH FROM ARTIST";
-query.setTemplate(PostgresAdapter.class.getName(), pgSQL);</programlisting></para>
-        
-        <section xml:id="sqltemplate-scripting">
-            <title>Scripting SQLTemplate with Velocity</title>
-            <para>The most interesting aspect of SQLTemplate (and the reason why it is called a
-                "template") is that a SQL string is treated by Cayenne as an Apache Velocity
-                template. Before sending it to DB as a PreparedStatement, the String is evaluated in
-                the Velocity context, that does variable substitutions, and performs special
-                callbacks in response to various directives, thus controlling query interaction with
-                the JDBC layer. </para>
-            <para>Check Velocity docs for the syntax details. Here we'll just mention the two main
-                scripting elements - "variables" (that look like <code>$var</code>) and "directives"
-                (that look like <code>#directive(p1 p2 p3)</code>). All built-in Velocity directives
-                are supported. Additionally Cayenne defines a number of its own directives to bind
-                parameters to PreparedStatements and to control the structure of the ResultSet.
-                These directives are described in the following sections.</para>
-        </section>
-        <section xml:id="sqltemplate-parameters">
-            <title>Variable Substitution</title>
-            <para>All variables in the template string are replaced from query
-                parameters:<programlisting language="java">SQLTemplate query = new SQLTemplate(Artist.class, "delete from $tableName");
-query.setParameters(Collections.singletonMap("tableName", "mydb.PAINTING"));
-
-// this will generate SQL like this: "delete from mydb.PAINTING"</programlisting>The
-                example above demonstrates the point made earlier in this chapter - even if we don't
-                know upfront which table the query will run against, we can still use a fixed "root"
-                in constructor (<code>Artist.class</code> in this case) , as we are not planning on
-                converting the result to objects.</para>
-            <para>Variable substitution within the text uses "<code>object.toString()</code>" method to replace the
-                variable value. Keep in mind that this may not be appropriate in all situations.
-                E.g. passing a date object in a WHERE clause expression may be converted to a String
-                not understood by the target RDBMS SQL parser. In such cases variable should be wrapped in <code>#bind</code>
-                directive as described below.</para>
-        </section>
-        <section xml:id="sqltemplate-bind-directive">
-            <title>Directives</title>
-            <para>These are the Cayenne directives used to customize SQLTemplate parsing and
-                integrate it with the JDBC layer: </para>
-            <section>
-                <title>#bind</title>
-                <para>Creates a PreparedStatement positional parameter in place of the directive,
-                    binding the value to it before statement execution. <code>#bind</code> is
-                    allowed in places where a "?" would be allowed in a PreparedStatement. And in
-                    such places it almost always makes sense to pass objects to the template via
-                    this or other forms of <code>#bind</code> instead of inserting them
-                    inline.</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#bind(value)
-#bind(value jdbcType)
-#bind(value jdbcType scale)</programlisting>
-                <para><emphasis role="italic">Arguments:</emphasis>
-                    <itemizedlist>
-                        <listitem>
-                            <para><code>value</code> - can either be a char constant or a variable
-                                that is resolved from the query parameters. Note that the variable
-                                can be a collection, that will be automatically expanded into a list
-                                of individual value bindings. This is useful for instance to build
-                                IN conditions. </para>
-                        </listitem>
-                        <listitem>
-                            <para><code>jdbcType</code> - is a JDBC data type of the parameter as
-                                defined in <code>java.sql.Types</code>.</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>scale</code> - An optional scale of the numeric value. Same
-                                as "scale" in PreparedStatement.</para>
-                        </listitem>
-                    </itemizedlist></para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#bind($xyz)
-#bind('str')
-#bind($xyz 'VARCHAR')
-#bind($xyz 'DECIMAL' 2)</programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID = #bind($id)</programlisting></para>
-            </section>
-            <section>
-                <title>#bindEqual</title>
-                <para>Same as #bind, but also includes the "=" sign in front of the value binding.
-                    Look at the example below - we took the #bind example and replaced "<code>ID =
-                        #bind(..)</code>" with "<code>ID #bindEqual(..)</code>". While it looks like
-                    a clumsy shortcut to eliminate the equal sign, the actual reason why this is
-                    useful is that it allows the value to be null. If the value is not null,
-                        "<code>= ?</code>" is generated, but if it is, the resulting chunk of the
-                    SQL would look like "<code>IS NULL</code>" and will be compilant with what the
-                    DB expects.</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#bindEqual(value)
-#bindEqual(value jdbcType)
-#bindEqual(value jdbcType scale)</programlisting>
-                <para><emphasis role="italic">Arguments: (same as #bind)</emphasis>
-                </para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#bindEqual($xyz)
-#bindEqual('str')
-#bindEqual($xyz 'VARCHAR')
-#bindEqual($xyz 'DECIMAL' 2)</programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
-            </section>
-            <section>
-                <title>#bindNotEqual</title>
-                <para>This directive deals with the same issue as <code>#bindEqual</code> above,
-                    only it generates "not equal" in front of the value (or IS NOT NULL).</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#bindNotEqual(value)
-#bindNotEqual(value jdbcType)
-#bindNotEqual(value jdbcType scale)</programlisting>
-                <para><emphasis role="italic">Arguments: (same as #bind)</emphasis></para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#bindNotEqual($xyz)
-#bindNotEqual('str')
-#bindNotEqual($xyz 'VARCHAR')
-#bindNotEqual($xyz 'DECIMAL' 2)</programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
-            </section>
-            <section>
-                <title>#bindObjectEqual</title>
-                <para>It can be tricky to use a Persistent object or an ObjectId in a binding,
-                    especially for tables with compound primary keys. This directive helps to handle
-                    such binding. It maps columns in the query to the names of Persistent object ID
-                    columns, extracts ID values from the object, and generates SQL like "COL1 = ?
-                    AND COL2 = ? ..." , binding positional parameters to ID values. It can also
-                    correctly handle null object. Also notice how we are specifying a Velocity array
-                    for multi-column PK.</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#bindObjectEqual(value columns idColumns)</programlisting>
-                <para><emphasis role="italic">Arguments:</emphasis>
-                    <itemizedlist>
-                        <listitem>
-                            <para><code>value</code> - must be a variable that is resolved from the
-                                query parameters to a Persistent or ObjectId.</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>columns</code> - the names of the columns to generate in the
-                                SQL.</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>idColumn</code> - the names of the ID columns for a given
-                                entity. Must match the order of "columns" to match against.</para>
-                        </listitem>
-                    </itemizedlist></para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#bindObjectEqual($a 't0.ID' 'ID')
-#bindObjectEqual($b ['t0.FK1', 't0.FK2'] ['PK1', 'PK2'])</programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">String sql = "SELECT * FROM PAINTING t0 WHERE #bindObjectEqual($a 't0.ARTIST_ID' 'ARTIST_ID' ) ORDER BY PAINTING_ID";
-SQLTemplate select = new SQLTemplate(Artist.class, sql);
-
-Artist a = ....
-select.setParameters(Collections.singletonMap("a", a)); </programlisting></para>
-            </section>
-            <section>
-                <title>#bindObjectNotEqual</title>
-                <para>Same as #bindObjectEqual above, only generates "not equal" operator for value
-                    comparison (or IS NOT NULL).</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#bindObjectNotEqual(value columns idColumns)</programlisting>
-                <para><emphasis role="italic">Arguments: (same as #bindObjectEqual)</emphasis>
-                </para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#bindObjectNotEqual($a 't0.ID' 'ID')
-#bindObjectNotEqual($b ['t0.FK1', 't0.FK2'] ['PK1', 'PK2'])</programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">String sql = "SELECT * FROM PAINTING t0 WHERE #bindObjectNotEqual($a 't0.ARTIST_ID' 'ARTIST_ID' ) ORDER BY PAINTING_ID";
-SQLTemplate select = new SQLTemplate(Artist.class, sql);
-
-Artist a = ....
-select.setParameters(Collections.singletonMap("a", a)); </programlisting></para>
-            </section>
-            <section>
-                <title>#result</title>
-                <para>Renders a column in SELECT clause of a query and maps it to a key in the
-                    result DataRow. Also ensures the value read is of the correct type. This allows
-                    to create a DataRow (and ultimately - a persistent object) from an arbitrary
-                    ResultSet.</para>
-                <para><emphasis role="italic">Semantics:</emphasis></para>
-                <programlisting language="java">#result(column)
-#result(column javaType)
-#result(column javaType alias)
-#result(column javaType alias dataRowKey)</programlisting>
-                <para><emphasis role="italic">Arguments:</emphasis>
-                    <itemizedlist>
-                        <listitem>
-                            <para><code>column</code> - the name of the column to render in SQL
-                                SELECT clause.</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>javaType</code> - a fully-qualified Java class name for a
-                                given result column. For simplicity most common Java types used in
-                                JDBC can be specified without a package. These include all numeric
-                                types, primitives, String, SQL dates, BigDecimal and BigInteger. So
-                                    "<code>#result('A' 'String')</code>", "<code>#result('B'
-                                    'java.lang.String')</code>" and "<code>#result('C'
-                                'int')</code>" are all valid</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>alias</code> - specifies both the SQL alias of the column
-                                and the value key in the DataRow. If omitted, "column" value is
-                                used.</para>
-                        </listitem>
-                        <listitem>
-                            <para><code>dataRowKey</code> - needed if SQL 'alias' is not appropriate
-                                as a DataRow key on the Cayenne side. One common case when this
-                                happens is when a DataRow retrieved from a query is mapped using
-                                joint prefetch keys (see below). In this case DataRow must use
-                                database path expressions for joint column keys, and their format is
-                                incompatible with most databases alias format. </para>
-                        </listitem>
-                    </itemizedlist></para>
-                <para>
-                    <emphasis role="italic"
-                    >Usage</emphasis>:<programlisting language="java">#result('NAME')
-#result('DATE_OF_BIRTH' 'java.util.Date') 
-#result('DOB' 'java.util.Date' 'DATE_OF_BIRTH')
-#result('DOB' 'java.util.Date' '' 'artist.DATE_OF_BIRTH') 
-#result('SALARY' 'float') </programlisting></para>
-                <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">SELECT #result('ID' 'int'), #result('NAME' 'String'), #result('DATE_OF_BIRTH' 'java.util.Date') FROM ARTIST</programlisting></para>
-            </section>
-            <section>
-                <title>#chain and #chunk</title>
-                
-                    <para><code>#chain</code> and <code>#chunk</code> directives are used for
-                    conditional inclusion of SQL code. They are used together with
-                        <code>#chain</code> wrapping multiple <code>#chunks</code>. A chunk
-                    evaluates its parameter expression and if it is NULL suppresses rendering of the
-                    enclosed SQL block. A chain renders its prefix and its chunks joined by the
-                    operator. If all the chunks are suppressed, the chain itself is suppressed. This
-                    allows to work with otherwise hard to script SQL semantics. E.g. a WHERE clause
-                    can contain multiple conditions joined with AND or OR. Application code would
-                    like to exclude a condition if its right-hand parameter is not present (similar
-                    to Expression pruning discussed above). If all conditions are excluded, the
-                    entire WHERE clause should be excluded. chain/chunk allows to do that.</para>
-                    <para>
-                    <emphasis role="italic"
-                    >Semantics</emphasis>:<programlisting language="java">#chain(operator) ... #end
-#chain(operator prefix) ... #end
-#chunk() ... #end
-#chunk(param) ... #end </programlisting></para>
-                    <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">#chain('OR' 'WHERE') 
-	#chunk($name) NAME LIKE #bind($name) #end" 
-	#chunk($id) ARTIST_ID > #bind($id) #end" 
-#end" </programlisting></para>
-          
-            </section>
-        </section>
-        <section>
-            <title>Mapping SQLTemplate Results</title>
-            <para>Here we'll discuss how to convert the data selected via SQLTemplate to some
-                useable format, compatible with other query results. It can either be very simple or
-                very complex, depending on the structure of the SQL, JDBC driver nature and the
-                desired result structure. This section presents various tips and tricks dealing with
-                result mapping. </para>
-            <para>By default SQLTemplate is expected to return a List of Persistent objects of its
-                root type. This is the simple
-                case:<programlisting language="java">SQLTemplate query = new SQLTemplate(Artist.class, "SELECT * FROM ARTIST");
-
-// List of Artists
-List&lt;Artist> artists = context.performQuery(query);</programlisting>Just
-                like SelectQuery, SQLTemplate can fetch DataRows. In fact DataRows option is very
-                useful with SQLTemplate, as the result type most often than not does not represent a
-                Cayenne entity, but instead may be some aggregated report or any other data whose
-                object structure is opaque to
-                Cayenne:<programlisting language="java">String sql = SELECT t0.NAME, COUNT(1) FROM ARTIST t0 JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) "
-    + "GROUP BY t0.NAME ORDER BY COUNT(1)";
-SQLTemplate query = new SQLTemplate(Artist.class, sql);
-
-// ensure we are fetching DataRows
-query.setFetchingDataRows(true);
-
-// List of DataRow
-List&lt;DataRow> rows = context.performQuery(query);</programlisting>In
-                the example above, even though the query root is Artist. the result is a list of
-                artist names with painting counts (as mentioned before in such case "root" is only
-                used to find the DB to fetch against, but has no bearning on the result). The
-                DataRows here are the most appropriate and desired result type.</para>
-            <para>In a more advanced case you may decide to fetch a list of scalars or a list of
-                Object[] with each array entry being either an entity or a scalar. You probably
-                won't be doing this too often and it requires quite a lot of work to setup, but if
-                you want your SQLTemplate to return results similar to EJBQLQuery, it is doable
-                using SQLResult as described
-                below:<programlisting language="java">SQLTemplate query = new SQLTemplate(Painting.class, "SELECT ESTIMATED_PRICE P FROM PAINTING");
-
-// let Cayenne know that result is a scalar
-SQLResult resultDescriptor = new SQLResult();
-resultDescriptor.addColumnResult("P");
-query.setResult(resultDescriptor);
-
-// List of BigDecimals
-List&lt;BigDecimal> prices = context.performQuery(query); </programlisting><programlisting language="java">SQLTemplate query = new SQLTemplate(Artist.class, "SELECT t0.ID, t0.NAME, t0.DATE_OF_BIRTH, COUNT(t1.PAINTING_ID) C " +
-      "FROM ARTIST t0 LEFT JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) " +
-      "GROUP BY t0.ID, t0.NAME, t0.DATE_OF_BIRTH");
-
-// let Cayenne know that result is a mix of Artist objects and the count of their paintings
-EntityResult artistResult = new EntityResult(Artist.class);
-artistResult.addDbField(Artist.ID_PK_COLUMN, "ARTIST_ID");
-artistResult.addObjectField(Artist.NAME_PROPERTY, "NAME");
-artistResult.addObjectField(Artist.DATE_OF_BIRTH_PROPERTY, "DATE_OF_BIRTH");
-
-SQLResult resultDescriptor = new SQLResult();
-resultDescriptor.addEntityResult(artistResult);
-resultDescriptor.addColumnResult("C");
-query.setResult(resultDescriptor);
-
-// List of Object[]
-List&lt;Object[]> data = context.performQuery(query);</programlisting></para>
-            <para>Another trick related to mapping result sets is making Cayenne recognize
-                prefetched entities in the result set. This emulates "joint" prefetching of
-                SelectQuery, and is achieved by special column naming. Columns belonging to the
-                "root" entity of the query should use unqualified names corresponding to the root
-                DbEntity columns. For each related entity column names must be prefixed with
-                relationship name and a dot (e.g. "toArtist.ID"). Column naming can be controlled
-                with "#result"
-                directive:<programlisting language="java">String sql = "SELECT distinct "
-    + "#result('t1.ESTIMATED_PRICE' 'BigDecimal' '' 'paintings.ESTIMATED_PRICE'), "
-    + "#result('t1.PAINTING_TITLE' 'String' '' 'paintings.PAINTING_TITLE'), "
-    + "#result('t1.GALLERY_ID' 'int' '' 'paintings.GALLERY_ID'), "
-    + "#result('t1.ID' 'int' '' 'paintings.ID'), "
-    + "#result('NAME' 'String'), "
-    + "#result('DATE_OF_BIRTH' 'java.util.Date'), "
-    + "#result('t0.ID' 'int' '' 'ID') "
-    + "FROM ARTIST t0, PAINTING t1 "
-    + "WHERE t0.ID = t1.ARTIST_ID";
-
-SQLTemplate q = new SQLTemplate(Artist.class, sql);
-q.addPrefetch(Artist.PAINTINGS_PROPERTY)
-List&lt;Artist> objects = context.performQuery(query);</programlisting></para>
-            <para>And the final tip deals with capitalization of the DataRow keys. Queries like
-                    "<code>SELECT * FROM...</code>" and even "<code>SELECT COLUMN1, COLUMN2, ...
-                    FROM ...</code>" can sometimes result in Cayenne exceptions on attempts to
-                convert fetched DataRows to objects. Essentially any query that is not using a
-                    <code>#result</code> directive to describe the result set is prone to this
-                problem, as different databases may produce different capitalization of the
-                java.sql.ResultSet columns. </para>
-            <para>The most universal way to address this issue is to describe each column explicitly
-                in the SQLTemplate via <code>#result</code>, e.g.: "<code>SELECT #result('column1'),
-                    #result('column2'), ..</code>". However this quickly becomes impractical for
-                tables with lots of columns. For such cases Cayenne provides a shortcut based on the
-                fact that an ORM mapping usually follows some naming convention for the column
-                names. Simply put, for case-insensitive databases developers normally use either all
-                lowercase or all uppercase column names. Here is the API that takes advantage of
-                that user knowledge and forces Cayenne to follow a given naming convention for the
-                DataRow keys (this is also available as a dropdown in the
-                Modeler):<programlisting language="java">SQLTemplate query = new SQLTemplate("SELECT * FROM ARTIST");
-query.setColumnNamesCapitalization(CapsStrategy.LOWER);
-List objects = context.performQuery(query);</programlisting></para>
-            <para>or<programlisting language="java">SQLTemplate query = new SQLTemplate("SELECT * FROM ARTIST");
-query.setColumnNamesCapitalization(CapsStrategy.UPPER);
-List objects = context.performQuery(query); </programlisting></para>
-            <para>None of this affects the generated SQL, but the resulting DataRows are using
-                correct capitalization. Note that you probably shouldn't bother with this unless you
-                are getting CayenneRuntimeExceptions when fetching with SQLTemplate.</para>
-        </section>
-    </section>
-    <section xml:id="procedurequery">
-        <title>ProcedureQuery</title>
-        <para>Stored procedures are mapped as separate objects in CayenneModeler. ProcedureQuery
-            provides a way to execute them with a certain set of parameters. Just like with
-            SQLTemplate, the outcome of a procedure can be anything - a single result set, mutliple
-            result sets, some data modification (returned as an update count), or a combination of
-            these. So use "performQuery" to get a single result set, and use "performGenericQuery"
-            for anything
-            else:<programlisting language="java">ProcedureQuery query = new ProcedureQuery("my_procedure", Artist.class);
-
-// Set "IN" parameter values
-query.addParam("p1", "abc");
-query.addParam("p2", 3000);
-
-List&lt;Artist> result = context.performQuery(query);</programlisting><programlisting language="java">// here we do not bother with root class. 
-// Procedure name gives us needed routing information
-ProcedureQuery query = new ProcedureQuery("my_procedure");
-
-query.addParam("p1", "abc");
-query.addParam("p2", 3000);
-
-QueryResponse response = context.performGenericQuery(query); </programlisting></para>
-        <para>A stored procedure can return data back to the application as result sets or via OUT
-            parameters. To simplify the processing of the query output, QueryResponse treats OUT
-            parameters as if it was a separate result set. If a stored procedure declares any OUT or
-            INOUT parameters, QueryResponse will contain their returned values in the very first
-            result
-            list:<programlisting language="java">ProcedureQuery query = new ProcedureQuery("my_procedure");
-QueryResponse response = context.performGenericQuery(query);
-
-// read OUT parameters
-List out = response.firstList();
-
-if(!out.isEmpty()) {
-    Map outParameterValues = (Map) outList.get(0);
-}</programlisting></para>
-        <para>There maybe a situation when a stored procedure handles its own transactions, but an
-            application is configured to use Cayenne-managed transactions. This is obviously
-            conflicting and undesirable behavior. In this case ProcedureQueries should be executed
-            explicitly wrapped in an "external" Transaction. This is one of the few cases when a
-            user should worry about transactions at all. See Transactions section for more
-            details.</para>
-    </section>
-    <section xml:id="namedquery">
-        <title>NamedQuery</title>
-        <para>NamedQuery is a query that is a reference to another query stored in the DataMap. The
-            actual stored query can be SelectQuery, SQLTemplate, EJBQLQuery, etc. It doesn't matter
-            - the API for calling them is the same - via a
-            NamedQuery:<programlisting language="java">String[] keys = new String[] {"loginid", "password"};
-Object[] values = new String[] {"joe", "secret"};
-
-NamedQuery query = new NamedQuery("Login", keys, values);
-
-List&lt;User> matchingUsers = context.performQuery(query); </programlisting></para>
-    </section>
-    <section xml:id="custom-queries">
-        <title>Custom Queries</title>
-        <para>If a user needs some extra functionality not addressed by the existing set of Cayenne
-            queries, he can write his own. The only requirement is to implement
-                <code>org.apache.cayenne.query.Query</code> interface. The easiest way to go about
-            it is to subclass some of the base queries in Cayenne. </para>
-        <para>E.g. to do something directly in the JDBC layer, you might subclass
-            AbstractQuery:<programlisting language="java">public class MyQuery extends AbstractQuery {
-
-    @Override
-    public SQLAction createSQLAction(SQLActionVisitor visitor) {
-        return new SQLAction() {
-
-            @Override
-            public void performAction(Connection connection, OperationObserver observer) throws SQLException, Exception {
-                // 1. do some JDBC work using provided connection... 
-                // 2. push results back to Cayenne via OperationObserver
-            }
-        };
-    }
-}</programlisting></para>
-        <para>To delegate the actual query execution to a standard Cayenne query, you may subclass
-            IndirectQuery:<programlisting language="java">public class MyDelegatingQuery extends IndirectQuery {
-    
-    @Override
-    protected Query createReplacementQuery(EntityResolver resolver) {
-        SQLTemplate delegate = new SQLTemplate(SomeClass.class, generateRawSQL());
-        delegate.setFetchingDataRows(true);
-        return delegate;
-    }
-    
-    protected String generateRawSQL() {
-        // build some SQL string
-    }
-}</programlisting></para>
-        <para>In fact many internal Cayenne queries are IndirectQueries, delegating to SelectQuery
-            or SQLTemplate after some preprocessing.</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml b/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
deleted file mode 100644
index 3c327da..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="rop-deployment">
-    <title>ROP Deployment</title>
-    <section xml:id="deploying-rop-server">
-        <title>Deploying ROP Server</title>
-
-        <note><para>Recent versions of Tomcat and Jetty containers (e.g. Tomcat 6 and 7, Jetty 8) contain code
-                addressing a security concern related to "session fixation problem" by resetting the
-                existing session ID of any request that requires BASIC authentcaition. If ROP
-                service is protected with declarative security (see the the ROP tutorial and the
-                following chapters on security), this feature prevents the ROP client from attaching
-                to its session, resulting in MissingSessionExceptions. To solve that you will need
-                to either switch to an alternative security mechanism, or disable "session fixation
-                problem" protections of the container. E.g. the later can be achieved in Tomcat 7 by
-                adding the following <emphasis>context.xml</emphasis> file to the webapp's META-INF/
-                directory:
-                <programlisting>&lt;Context>
-    &lt;Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
-            changeSessionIdOnAuthentication="false" />
-&lt;/Context></programlisting>(The
-                &lt;Valve> tag can also be placed within the &lt;Context> in any other locations
-                used by Tomcat to load context configurations)</para></note>
-
-    </section>
-    <section xml:id="deploying-rop-client">
-        <title>Deploying ROP Client</title>
-    </section>
-    <section xml:id="rop-security">
-        <title>Security</title>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/rop-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/rop-introduction.xml b/docs/docbook/cayenne-guide/src/docbkx/rop-introduction.xml
deleted file mode 100644
index fb32ca4..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/rop-introduction.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="introduction-to-rop">
-    <title>Introduction to ROP</title>
-    <section xml:id="what-is-rop">
-        <title>What is ROP</title>
-		<para>"Remote Object Persistence" is a low-overhead web services-based technology that
-			provides lightweight object persistence and query functionality to 'remote'
-			applications. In other words it provides familiar Cayenne API to applications that do
-			not have direct access to the database. Instead such applications would access Cayenne
-			Web Service (CWS). A single abstract data model (expressed as Cayenne XML DataMap) is
-			used on the server and on the client, while execution logic can be partitioned between
-			the tiers.The following picture compares a regular Cayenne web application and a rich
-			client application that uses remote object persistence technology:</para>
-    	<para><inlinemediaobject>
-    		<imageobject>
-    			<imagedata fileref="images/remote-object-persistence.jpg" scalefit="1" width="100%"/>
-    		</imageobject>
-    	</inlinemediaobject></para>
-		<para>Persistence stack above consists of the following parts:<itemizedlist>
-				<listitem>
-					<para>ORM Tier: a server-side Cayenne Java application that directly connects to
-						the database via JDBC.</para>
-				</listitem>
-				<listitem>
-					<para>CWS (Cayenne Web Service): A wrapper around an ORM tier that makes it
-						accessible to remote CWS clients.</para>
-				</listitem>
-				<listitem>
-					<para>Remote Tier (aka Client Tier): A Java application that has no direct DB
-						connection and persists its objects by connecting to remote Cayenne Web
-						Service (CWS). Note that CWS Client doesn't have to be a desktop
-						application. It can be another server-side application. The word "client"
-						means a client of Cayenne Web Service.</para>
-				</listitem>
-			</itemizedlist></para>
-    </section>
-    <section xml:id="main-features">
-        <title>Main Features</title>
-		<itemizedlist>
-			
-					<listitem>
-						<para>Unified approach to lightweight object persistence across multiple
-							tiers of a distributed system.</para>
-					</listitem>
-					<listitem>
-						<para>Same abstract object model on the server and on the client.</para>
-					</listitem>
-					<listitem>
-						<para>Client can "bootstrap" from the server by dynamically loading
-							persistence metadata.</para>
-					</listitem>
-					<listitem>
-						<para>An ability to define client objects differently than the server ones,
-							and still have seamless persistence.</para>
-					</listitem>
-					<listitem>
-						<para>Generic web service interface that doesn't change when object model
-							changes.</para>
-					</listitem>
-					<listitem>
-						<para>An ability to work in two modes: dedicated session mode or shared
-							("chat") mode when multiple remote clients collaboratively work on the
-							same data.</para>
-					</listitem>
-					<listitem>
-						<para>Lazy object and collection faulting.</para>
-					</listitem>
-					<listitem>
-						<para>Full context lifecycle</para>
-					</listitem>
-					<listitem>
-						<para>Queries, expressions, local query caching, paginated queries.</para>
-					</listitem>
-					<listitem>
-						<para>Validation</para>
-					</listitem>
-					<listitem>
-						<para>Delete Rules</para>
-					</listitem>
-		</itemizedlist>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/rop-setup.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/rop-setup.xml b/docs/docbook/cayenne-guide/src/docbkx/rop-setup.xml
deleted file mode 100644
index dde1922..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/rop-setup.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="rop-setup">
-    <title>ROP Setup</title>
-    <section xml:id="rop-system-requirements">
-        <title>System Requirements</title>
-    </section>
-    <section xml:id="rop-jar-files-dependencies">
-        <title>Jar Files and Dependencies</title>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/setup.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/setup.xml b/docs/docbook/cayenne-guide/src/docbkx/setup.xml
deleted file mode 100644
index 75847a4..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/setup.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="setup">
-    <title>Setup</title>
-    <section xml:id="system-requirements">
-        <title>System Requirements</title>
-        <para>
-            <itemizedlist>
-                <listitem>
-                    <para><emphasis role="italic">Java</emphasis>: Cayenne runtime framework and
-                        CayenneModeler GUI tool are written in 100% Java, and run on any
-                        Java-compatible platform. Required JDK version is 1.5 or higher. The last
-                        version of Cayenne compatible with JDK 1.4 is 1.2.x/2.0.x and JDK 1.3 is 1.1.x</para>
-                </listitem>
-            </itemizedlist>
-            <itemizedlist>
-                <listitem>
-                    <para><emphasis role="italic">JDBC Driver:</emphasis> An appropriate DB-specific
-                        JDBC driver is needed to access the database. It can be included in the
-                        application or used in web container DataSource configuration.</para>
-                </listitem>
-            </itemizedlist>
-            <itemizedlist>
-                <listitem>
-                    <para><emphasis role="italic">Third-party Libraries:</emphasis> Cayenne runtime
-                        framework has a minimal set of required and a few more optional dependencies
-                        on third-party open source packages. See "Including Cayenne in a Project"
-                        chapter for details.</para>
-                </listitem>
-            </itemizedlist>
-        </para>
-    </section>
-    <section xml:id="running-cayennemodeler">
-        <title>Running CayenneModeler</title>
-        <para>CayenneModeler GUI tool is intended to work with object relational mapping projects. While
-            you can edit your XML by hand, it is rarely needed, as the Modeler is a pretty advanced
-            tool included in Cayenne distribution. To obtain CayenneModeler, download Cayenne
-            distribution archive from <link xlink:href="http://cayenne.apache.org/download.html"
-                >http://cayenne.apache.org/download.html</link> matching the OS you are using. Of
-            course Java needs to be installed on the machine where you are going to run the
-            Modeler.</para>
-        <para>OS X distribution contains CayenneModeler.app at the root of the distribution disk
-            image.</para>
-        <para>Windows distribution contains CayenneModeler.exe file in the <code>bin</code>
-            directory.</para>
-        <para>Cross-platform distribution (targeting Linux, but as the name implies, compatible with any
-            OS) contains a runnable CayenneModeler.jar in the <code>bin</code> directory. It can be
-            executed either by double-clicking, or if the environment is not configured to execute
-            jars, by running from command-line:</para>
-        <programlisting>java -jar CayenneModeler.jar</programlisting>
-        <para>The Modeler can also be started from Maven. While it may look like an exotic way to start a
-            GUI application, it has its benefits - no need to download Cayenne distribution, the
-            version of the Modeler always matches the version of the framework, the plugin can find
-            mapping files in the project automatically. So is an attractive option to some
-            developers. Maven option requires a declaration in the
-            POM:<programlisting>&lt;build>
-    &lt;plugins>
-        &lt;plugin>
-            &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
-            &lt;artifactId>maven-cayenne-modeler-plugin&lt;/artifactId>
-            &lt;version>X.Y.Z&lt;/version>
-        &lt;/plugin>
-    &lt;/plugins>
-&lt;/build></programlisting></para>
-        <para>And then can be run as <programlisting>mvn cayenne-modeler:run</programlisting></para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml b/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
deleted file mode 100644
index 4bb5cd2..0000000
--- a/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
-    version="5.0" xml:id="starting-cayenne">
-    <title>Starting Cayenne</title>
-    <section xml:id="starting-serverruntime">
-        <title>Starting and Stopping ServerRuntime</title>
-        <para>In runtime Cayenne is accessed via
-                <code>org.apache.cayenne.configuration.server.ServerRuntime</code>. ServerRuntime is
-            created simply by calling a
-            constructor:<programlisting language="java">ServerRuntime runtime = new ServerRuntime("com/example/cayenne-project.xml");</programlisting></para>
-        <para>The parameter you pass to the constructor is a location of the main project file. Location
-            is a '/'-separated path (same path separator is used on UNIX and Windows) that is
-            resolved relative to the application classpath. The project file can be placed in the
-            root package or in a subpackage (e.g. in the code above it is in "com/example"
-            subpackage).</para>
-        <para>ServerRuntime encapsulates a single Cayenne stack. Most applications will just have
-            one ServerRuntime using it to create as many ObjectContexts as needed, access the
-            Dependency Injection (DI) container and work with other Cayenne features. Internally
-            ServerRuntime is just a thin wrapper around the DI container. Detailed features of the
-            container are discussed in "Customizing Cayenne Runtime" chapter. Here we'll just show
-            an example of how an application might replace a default implementation of a built-in
-            Cayenne service (in this case - QueryCache) with a different
-            class:<programlisting language="java">public class MyExtensionsModule implements Module {
-    public void configure(Binder binder) {
-        binder.bind(QueryCache.class).to(EhCacheQueryCache.class);
-    }
-}</programlisting><programlisting language="java">Module extensions = new MyExtensionsModule();
-ServerRuntime runtime = new ServerRuntime("com/example/cayenne-project.xml", extensions);</programlisting></para>
-        <para>It is a good idea to shut down the runtime when it is no longer needed, usually before the
-            application itself is shutdown: <programlisting language="java">runtime.shutdown();</programlisting>When
-            a runtime object has the same scope as the application, this may not be always
-            necessary, however in some cases it is essential, and is generally considered a good
-            practice. E.g. in a web container hot redeploy of a webapp will cause resource leaks and
-            eventual OutOfMemoryError if the application fails to shutdown CayenneRuntime.</para>
-    </section>
-    <section>
-        <title>Merging Multiple Projects</title>
-        <para>ServerRuntime requires at least one mapping project to run. But it can also take multiple
-            projects and merge them together in a single configuration. This way different parts of
-            a database can be mapped independenlty from each other (even by different software
-            providers), and combined in runtime when assembling an application. Doing it is as easy
-            as passing multiple project locations to ServerRuntime constructor:</para><programlisting language="java">ServerRuntime runtime = new ServerRuntime(new String[] {
-        "com/example/cayenne-project.xml",
-        "org/foo/cayenne-library1.xml",
-        "org/foo/cayenne-library2.xml"
-    }
-);</programlisting>
-        <para>When the projects are merged, the following rules are applied:<itemizedlist>
-                <listitem>
-                    <para>The order of projects matters during merge. If there are two conflicting
-                        metadata objects belonging to two projects, an object from the <emphasis
-                            role="italic">last</emphasis> project takes precedence over the object
-                        from the first one. This makes possible to override pieces of metadata. This
-                        is also similar to how DI modules are merged in Cayenne.</para>
-                </listitem>
-                <listitem>
-                    <para>Runtime DataDomain name is set to the name of the last project in the
-                        list.</para>
-                </listitem>
-                <listitem>
-                    <para>Runtime DataDomain properties are the same as the properties of the last
-                        project in the list. I.e. <emphasis role="italic">properties are not
-                            merged</emphasis> to avoid invalid combinations and unexpected runtime
-                        behavior.</para>
-                </listitem>
-                <listitem>
-                    <para>If there are two or more DataMaps with the same name, only one DataMap is
-                        used in the merged project, the rest are discarded. Same precedence rules
-                        apply - DataMap from the project with the highest index in the project list
-                        overrides all other DataMaps with the same name.</para>
-                </listitem>
-                <listitem>
-                    <para>If there are two or more DataNodes with the same name, only one DataNodes
-                        is used in the merged project, the rest are discarded. DataNode coming from
-                        project with the highest index in the project list is chosen per precedence
-                        rule above.</para>
-                </listitem>
-                <listitem>
-                    <para>There is a notion of "default" DataNode. After the merge if any DataMaps
-                        are not explicitly linked to DataNodes, their queries will be executed via a
-                        default DataNode. This makes it possible to build mapping "libraries" that
-                        are only associated with a specific database in runtime. If there's only one
-                        DataNode in the merged project, it will be automatically chosen as default.
-                        A possible way to explicitly designate a specific node as default is to
-                        override <code>DataDomainProvider.createAndInitDataDomain()</code>.</para>
-                </listitem>
-            </itemizedlist></para>
-    </section>
-    <section xml:id="webapps">
-        <title>Web Applications</title>
-        <para>Web applications can use a variety of mechanisms to configure and start the "services"
-            they need, Cayenne being one of such services. Configuration can be done within standard
-            Servlet specification objects like Servlets, Filters, or ServletContextListeners, or can
-            use Spring, JEE CDI, etc. This is a user's architectural choice and Cayenne is agnostic
-            to it and will happily work in any environment. As described above, all that is needed
-            is to create an instance of ServerRuntime somewhere and provide the application code
-            with means to access it. And shut it down when the application ends to avoid container
-            leaks.</para>
-        <para>Still Cayenne includes a piece of web app configuration code that can assist in
-            quickly setting up simple Cayenne-enabled web applications. We are talking about
-            CayenneFilter. It is declared in
-            web.xml:<programlisting>&lt;web-app>
-    ...
-    &lt;filter>
-        &lt;filter-name>cayenne-project&lt;/filter-name>
-        &lt;filter-class>org.apache.cayenne.configuration.web.CayenneFilter&lt;/filter-class>
-    &lt;/filter>
-     &lt;filter-mapping>
-        &lt;filter-name>cayenne-project&lt;/filter-name>
-        &lt;url-pattern>/*&lt;/url-pattern>
-     &lt;/filter-mapping>
-    ...
- &lt;/web-app>       </programlisting></para>
-        <para>When started by the web container, it creates a instance of ServerRuntime and stores
-            it in the ServletContext. Note that the name of Cayenne XML project file is derived from
-            the "filter-name". In the example above CayenneFilter will look for an XML file
-            "cayenne-project.xml". This can be overridden with "configuration-location" init
-            parameter.</para>
-        <para>When the application runs, all HTTP requests matching the filter url-pattern will have
-            access to a session-scoped ObjectContext like
-            this:<programlisting language="java">ObjectContext context = BaseContext.getThreadObjectContext();</programlisting>Of
-            course the ObjectContext scope, and other behavior of the Cayenne runtime can be
-            customized via dependency injection. For this another filter init parameter called
-            "extra-modules" is used. "extra-modules" is a comma or space-separated list of class
-            names, with each class implementing Module interface. These optional custom modules are
-            loaded after the the standard ones, which allows users to override all standard
-            definitions.</para>
-        <para>For those interested in the DI container contents of the runtime created by CayenneFilter,
-            it is the same ServerRuntime as would've been created by other means, but with an extra
-                <code>org.apache.cayenne.configuration.web.WebModule</code> module that provides
-                <code>org.apache.cayenne.configuration.web.RequestHandler</code> service. This is
-            the service to override in the custom modules if you need to provide a different
-            ObjectContext scope, etc.</para>
-        <para>
-            <note>
-                <para>You should not think of CayenneFilter as the only way to start and use Cayenne in a web
-                    application. In fact CayenneFilter is entirely optional. Use it if you don't
-                    have any special design for application service management. If you do, simply
-                    integrate Cayenne into that design.</para>
-            </note>
-        </para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/images/.gitignore
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/images/.gitignore b/docs/docbook/cayenne-guide/src/images/.gitignore
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/cayenne-guide/src/images/remote-object-persistence.jpg
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/images/remote-object-persistence.jpg b/docs/docbook/cayenne-guide/src/images/remote-object-persistence.jpg
deleted file mode 100644
index 43f820d..0000000
Binary files a/docs/docbook/cayenne-guide/src/images/remote-object-persistence.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/pom.xml b/docs/docbook/docbook-stylesheets/pom.xml
deleted file mode 100644
index 66f7b84..0000000
--- a/docs/docbook/docbook-stylesheets/pom.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-    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.   
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.cayenne.docs</groupId>
-        <artifactId>cayenne-docbook</artifactId>
-        <version>3.1.3-SNAPSHOT</version>
-    </parent>
-
-    <groupId>org.apache.cayenne.docs</groupId>
-    <artifactId>docbook-stylesheets</artifactId>
-    <version>3.1.3-SNAPSHOT</version>
-    <name>Docbook: Cayenne Stylesheets</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
-    </build>
-
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css b/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
deleted file mode 100644
index 57f7ea6..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
+++ /dev/null
@@ -1,140 +0,0 @@
-@IMPORT url("highlight.css");
-
-html {
-    padding:       0pt;
-    margin:        0pt;
-}
-
-body, td {
-    margin-left:   10%;
-    margin-right:  10%;
-    font-family:   "Lucida Grande","Trebuchet MS",Verdana,sans-serif;
-    font-size: small;
-}
-
-div {
-    margin:        0pt;
-}
-
-p {
-    text-align:    justify;
-}
-
-hr {
-    border:        1px solid gray;
-    background:    gray;
-}
-
-h1, h2, h3, h4 {
-    font-family: "Trebuchet MS","Lucida Grande",Verdana,sans-serif;
-    font-weight: normal;
-    line-height: normal;
-    margin: 1em 0 0.5em;
-}
-
-h2 {
-    color: #660000;
-    font-size: 170%;
-    padding: 0;
-}
-
-h3 {
-    border-bottom: 1px solid #EAEAEA;
-    color: #CC4400;
-    font-size: 135%;
-    padding-bottom: 3px;
-}
-
-h4 {
-    color: #AAAA99;
-    font-size: 130%;
-}
-
-pre {
-    line-height:   1.0;
-    color:         black;
-
-    -moz-tab-size: 4;
-    -o-tab-size:   4;
-    tab-size:      4;
-}
-
-pre.programlisting {
-    font-size:     10pt;
-    padding:       7pt 3pt;
-    border:        1pt solid black;
-    background:    #F9F9F6;
-    clear:         both;
-}
-
-div.table {
-    margin:        1em;
-    padding:       0.5em;
-    text-align:    center;
-}
-
-table[frame=void] {
-    display:       table;
-    width:         100%;
-    border:        1px black solid;
-    border-collapse: collapse;
-    border-spacing: 0;
-}
-
-table[frame=void] td {
-    padding-left:  7px;
-    padding-right: 7px;
-    border:        1px black solid;
-}
-
-table[frame=void] th {
-    padding-left:  7px;
-    padding-right: 7px;
-    border:        1px black solid;
-}
-
-.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;
-}
-
-.code {
-    font-family: Courier New,monospace;
-}
-
-.mediaobject {
-    padding-top: 30px;
-    padding-bottom: 30px;
-}
-
-.legalnotice {
-    font-size: 12px;
-    font-style: italic;
-}
-
-p.releaseinfo {
-    font-size: 100%;
-    font-weight: bold;
-    padding-top: 10px;
-}
-
-p.pubdate {
-    font-size: 120%;
-    font-weight: bold;
-}
-
-span.productname {
-    font-size: 200%;
-    font-weight: bold;
-}
-
-th.versioninfo {
-    font-size: 10px;
-    font-weight: normal;
-    text-align: left;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/css/highlight.css
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/css/highlight.css b/docs/docbook/docbook-stylesheets/src/main/resources/css/highlight.css
deleted file mode 100644
index f6a057d..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/css/highlight.css
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-   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 !important;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/common-customizations.xsl
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/common-customizations.xsl b/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/common-customizations.xsl
deleted file mode 100644
index d51510d..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/common-customizations.xsl
+++ /dev/null
@@ -1,32 +0,0 @@
-<?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" version="1.0">
-
-	<!-- The next line is needed to work with maven injecting the docbook stylesheets -->
-	<!---->
-	<!-- <xsl:import href="urn:docbkx:stylesheet/highlight.xsl"/> -->
-
-	<xsl:param name="keep.relative.image.uris" select="1"/>
-	<xsl:param name="toc.section.depth">1</xsl:param>
-
-	<!-- disable TOC for each part -->
-	<xsl:template name="generate.part.toc" />
-
-</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/highlight.xsl
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/highlight.xsl b/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/highlight.xsl
deleted file mode 100644
index e25baf0..0000000
--- a/docs/docbook/docbook-stylesheets/src/main/resources/stylesheets/highlight.xsl
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<!--
-    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.
--->
-<!--This file was created automatically by html2xhtml-->
-<!--from the HTML stylesheets.-->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:d="http://docbook.org/ns/docbook"
-                xmlns:xslthl="http://xslthl.sf.net" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xslthl d" version="1.0">
-
-    <xsl:import href="urn:docbkx:stylesheet/highlight.xsl"/>
-    <!-- ********************************************************************
-   $Id: highlight.xsl 8911 2010-09-28 17:02:06Z abdelazer $
-   ********************************************************************
-
-   This file is part of the XSL DocBook Stylesheet distribution.
-   See ../README or http://docbook.sf.net/release/xsl/current/ for
-   and other information.
-
-
-
-   ******************************************************************** -->
-    <!-- <xsl:import href="urn:/highlighting/common.xsl"/> -->
-    <xsl:template match="xslthl:keyword" mode="xslthl">
-        <span class="hl-keyword">
-            <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>
-    <xsl:template match="xslthl:comment" mode="xslthl">
-        <span class="hl-comment">
-            <xsl:apply-templates mode="xslthl"/>
-        </span>
-    </xsl:template>
-    <xsl:template match="xslthl:directive" mode="xslthl">
-        <span class="hl-directive">
-            <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:html" mode="xslthl">
-        <strong>
-            <span>
-                <xsl:apply-templates mode="xslthl"/>
-            </span>
-        </strong>
-    </xsl:template>
-    <xsl:template match="xslthl:xslt" mode="xslthl">
-        <span>
-            <xsl:apply-templates mode="xslthl"/>
-        </span>
-    </xsl:template>
-    <!-- Not emitted since XSLTHL 2.0 -->
-    <xsl:template match="xslthl:section" mode="xslthl">
-        <span>
-            <xsl:apply-templates mode="xslthl"/>
-        </span>
-    </xsl:template>
-    <xsl:template match="xslthl:number" mode="xslthl">
-        <span class="hl-number">
-            <xsl:apply-templates mode="xslthl"/>
-        </span>
-    </xsl:template>
-    <xsl:template match="xslthl:annotation" mode="xslthl">
-        <span class="hl-annotation">
-            <xsl:apply-templates mode="xslthl"/>
-        </span>
-    </xsl:template>
-    <!-- Not sure which element will be in final XSLTHL 2.0 -->
-    <xsl:template match="xslthl:doccomment|xslthl:doctype" mode="xslthl">
-        <strong class="hl-tag">
-            <xsl:apply-templates mode="xslthl"/>
-        </strong>
-    </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file


[02/11] cayenne git commit: CAY-2371 Switch documentation from Docbook to Asciidoctor format

Posted by nt...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/index.xml b/docs/docbook/getting-started/src/docbkx/index.xml
deleted file mode 100644
index 8a18e1e..0000000
--- a/docs/docbook/getting-started/src/docbkx/index.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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.
--->
-<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <info>
-        <title>Getting Started with Cayenne</title>
-        <copyright>
-            <year>2011-2017</year>
-            <holder>Apache Software Foundation and individual authors</holder>
-        </copyright>
-        <legalnotice>
-            <title>License</title>
-            <para>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</para>
-            
-            <para>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.</para>
-        </legalnotice>
-    </info>
-    <xi:include href="part1.xml"/>
-    <xi:include href="part2.xml"/>
-    <xi:include href="part3.xml"/>
-    <xi:include href="part4.xml"/>
-</book>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/java-classes.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/java-classes.xml b/docs/docbook/getting-started/src/docbkx/java-classes.xml
deleted file mode 100644
index 20c8b6f..0000000
--- a/docs/docbook/getting-started/src/docbkx/java-classes.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Creating Java Classes</title>
-    <para>Here we'll generate the Java classes from the model that was created in the previous
-        section. CayenneModeler can be used to also generate the database schema, but since we
-        specified "CreateIfNoSchemaStrategy" earlier when we created a DataNode, we'll skip the
-        database schema step. Still be aware that you can do it if you need to via "Tools &gt;
-        Create Database Schema".
-    </para>
-    <section xml:id="creating-java-classes">
-        <title>Creating Java Classes</title>
-        <itemizedlist>
-            <listitem>
-                <para>Select "Tools &gt; Generate Classes" menu.</para>
-            </listitem>
-            <listitem>
-                <para>For "Type" select "Standard Persistent Objects", if it is not already
-                    selected.</para>
-            </listitem>
-            <listitem>
-                <para>For the "Output Directory" select "src/main/java" folder under your Eclipse
-                    project folder (this is a "peer" location to the cayenne-*.xml location we
-                    selected before).</para>
-            </listitem>
-            <listitem>
-                <para>Click on "Entities" tab and check the "Check All Classes" checkbox (unless it
-                    is already checked and reads "Uncheck all Classes").</para>
-            </listitem>
-            <listitem>
-                <para>Click "Generate"</para>
-            </listitem>
-        </itemizedlist>
-        <para>Now go back to Eclipse, right click on "tutorial" project and select "Refresh" - you
-            should see pairs of classes generated for each mapped entity. You probably also see that
-            there's a bunch of red squiggles next to the newly generated Java classes in Eclipse.
-            This is because our project does not include Cayenne as a Maven dependency yet. Let's
-            fix it now by adding "cayenne-server" artifact in the bottom of the pom.xml file. The
-            resulting POM should look like
-            this:<programlisting>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
-    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
-    &lt;groupId&gt;org.example.cayenne&lt;/groupId&gt;
-    &lt;artifactId&gt;tutorial&lt;/artifactId&gt;
-    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
-
-    &lt;dependencies&gt;
-        &lt;dependency&gt;
-            &lt;groupId&gt;org.apache.cayenne&lt;/groupId&gt;
-            &lt;artifactId&gt;cayenne-server&lt;/artifactId&gt;
-   &lt;!-- Here specify the version of Cayenne you are actually using --&gt;
-            &lt;version&gt;3.1.2&lt;/version&gt;
-        &lt;/dependency&gt;
-    &lt;/dependencies&gt;
-&lt;/project&gt;</programlisting></para>
-        <para>Your computer must be connected to the internet. Once you save the pom.xml, Eclipse
-            will download the needed Cayenne jar file and add it to the project build path. As a
-            result, all the errors should disappear.</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/eclipse-generatedclasses.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        <para>Now let's check the entity class pairs. Each one is made of a superclass (e.g. Artist)
-            and a subclass (e.g. Artist). You <emphasis role="bold">should not</emphasis> modify the
-            superclasses whose names start with "_" (underscore), as they will be replaced on
-            subsequent generator runs. Instead all custom logic should be placed in the subclasses
-            in "org.example.cayenne.persistent" package - those will never be overwritten by the
-            class generator.</para>
-        <para>
-            <note>
-                <para><emphasis role="bold">Class Generation
-                    Hint</emphasis> Often you'd start by generating classes from the
-                    Modeler, but at the later stages of the project the generation is usually
-                    automated either via Ant cgen task or Maven cgen mojo. All three methods are
-                    interchangeable, however Ant and Maven methods would ensure that you never
-                    forget to regenerate classes on mapping changes, as they are integrated into
-                    the build cycle.</para>
-            </note>
-        </para>
-        
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/object-context.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/object-context.xml b/docs/docbook/getting-started/src/docbkx/object-context.xml
deleted file mode 100644
index c5176e6..0000000
--- a/docs/docbook/getting-started/src/docbkx/object-context.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Getting started with ObjectContext</title>
-    <para>In this section we'll write a simple main class to run our application, and get a brief
-    introduction to Cayenne ObjectContext.</para>
-    <section xml:id="creating-main-class">
-        <title>Creating the Main Class</title>
-        <itemizedlist>
-            <listitem>
-                <para>In Eclipse create a new class called "Main" in the "org.example.cayenne"
-                    package.</para>
-            </listitem>
-            <listitem>
-                <para>Create a standard "main" method to make it a runnable
-                    class:<programlisting language="java">package org.example.cayenne;
-
-public class Main {
-
-    public static void main(String[] args) {
-
-    }
-}</programlisting></para>
-            </listitem>
-            <listitem>
-                <para>The first thing you need to be able to access the database is to create a
-                    ServerRuntime object (which is essentially a wrapper around Cayenne stack) and
-                    use it to obtain an instance of an
-                    ObjectContext.<programlisting language="java">package org.example.cayenne;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.server.ServerRuntime;
-
-public class Main {
-
-    public static void main(String[] args) {
-        ServerRuntime cayenneRuntime = new ServerRuntime(
-                "cayenne-project.xml");
-        ObjectContext context = cayenneRuntime.getContext();
-    }
-}</programlisting></para>
-                <para>ObjectContext is an isolated "session" in Cayenne that provides all needed API
-                    to work with data. ObjectContext has methods to execute queries and manage
-                    persistent objects. We'll discuss them in the following sections. When the first
-                    ObjectContext is created in the application, Cayenne loads XML mapping files and
-                    creates a shared access stack that is later reused by other ObjectContexts.
-                </para>
-            </listitem>
-        </itemizedlist>
-    </section>
-    <section xml:id="runnning-app">
-        <title>Running Application</title>
-        <para>Let's check what happens when you run the application. But before we do that we need
-            to add another dependency to the pom.xml - Apache Derby, our embedded database engine.
-            The following piece of XML needs to be added to the
-            &lt;dependencies&gt;...&lt;/dependencies&gt; section, where we already have Cayenne
-            jars:<programlisting>&lt;dependency&gt;
-   &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
-   &lt;artifactId&gt;derby&lt;/artifactId&gt;
-   &lt;version&gt;10.8.1.2&lt;/version&gt;
-&lt;/dependency&gt;</programlisting>Now
-            we are ready to run. Right click the "Main" class in Eclipse and select "Run As &gt;
-            Java Application". In the console you'll see output similar to this, indicating that
-            Cayenne stack has been
-                started:<programlisting>INFO: Loading XML configuration resource from file:cayenne-project.xml
-INFO: loading user name and password.
-INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
-    Driver class: org.apache.derby.jdbc.EmbeddedDriver
-    Min. connections in the pool: 1
-    Max. connections in the pool: 1</programlisting>
-            
-            <note><para><emphasis role="bold">How to Configure Cayenne Logging.</emphasis>  Follow the instructions in
-                    the logging chapter to tweak verbosity of the logging output.</para></note>
-           </para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml b/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml
deleted file mode 100644
index 8fb5207..0000000
--- a/docs/docbook/getting-started/src/docbkx/object-relational-mapping.xml
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Getting started with Object Relational Mapping (ORM)</title>
-    <para> The goal of this section is to learn how to create a simple Object-Relational model with
-        CayenneModeler. We will create a complete ORM model for the following database
-        schema:</para>
-    <para><inlinemediaobject>
-            <imageobject>
-                <imagedata fileref="images/database-schema.jpg"/>
-            </imageobject>
-    </inlinemediaobject>
-    </para>
-    <para>
-        <note><para>Very often you'd have an existing database already, and
-            it can be quickly imported in Cayenne via "Tools &gt; Reengineer Database
-            Schema". This will save you lots of time compared to manual mapping. However
-            understanding how to create the mapping by hand is important, so we are showing
-            the "manual" approach below.</para></note>
-    </para>
-    <section xml:id="mapping-db-tables-and-columns">
-        <title>Mapping Database Tables and Columns</title>
-        <para>Lets go back to CayenneModeler where we have the newly created project open and start
-            by adding the ARTIST table. Database tables are called <emphasis role="bold"
-                >"DbEntities"</emphasis> in Cayenne mapping (those can be actual tables or database
-            views). </para>
-        <para>Select "datamap" on the left-hand side project tree and click "Create DbEntity" button
-            (or use "Project &gt; Create DbEntity" menu). A new DbEntity is created. In "DbEntity
-            Name" field enter "ARTIST". Then click on "Create Attribute" button on the entity
-            toolbar (third button from the left). This action changes the view to the "Attribute"
-            tab and adds a new attribute (attribute means a "table column" in this case) called
-            "untitledAttr". Let's rename it to ID, make it an INTEGER and make it a PK:</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/modeler-artistid.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        <para>Similarly add NAME VARCHAR(200) and DATE_OF_BIRTH DATE attributes. After that repeat
-            this procedure for PAINTING and GALLERY entities to match DB schema shown above.</para>
-        <para>
-            <note>
-                <para>Don't forget to save your project periodically to
-                    avoid losing your work. You will also have to refresh the project in Eclipse
-                    after every CayenneModeler save, as Eclipse is by default unaware of any
-                    changes made in the Modeler.</para>
-            </note>
-        </para>
-    </section>
-    <section xml:id="mapping-db-relationships">
-        <title>Mapping Database Relationships</title>
-        <para>Now we need to specify relationships between ARTIST, PAINTING and GALLERY tables.
-            Start by creating a one-to-many ARTIST/PAINTING relationship:</para>
-        <itemizedlist>
-            <listitem>
-                <para>Select the ARTIST DbEntity on the left and click on the "Relationships"
-                    tab.</para>
-            </listitem>
-            <listitem>
-                <para>Click on "Create Relationship" button on the entity toolbar (second button
-                    from the left) - a relationship called "untitledRel" is created.</para>
-            </listitem>
-            <listitem>
-                <para>Choose the "Target" to be "Painting".</para>
-            </listitem>
-            <listitem>
-                <para>Click on the "Database Mapping" button (letter "I" in a circle) - relationship
-                    configuration dialog is presented. Here you can assign a name to the
-                    relationship and also its complimentary reverse relationship. This name can be
-                    anything (this is really a symbolic name of the database referential
-                    constraint), but it is recommended to use a valid Java identifier, as this will
-                    save some typing later. We'll call the relationship "paintings" and reverse
-                    relationship "artist".</para>
-            </listitem>
-            <listitem>
-                <para>Click on "Add" button on the right to add a join</para>
-            </listitem>
-            <listitem>
-                <para>Select "ID" column for the "Source" and "ARTIST_ID" column for the
-                    target.</para>
-            </listitem>
-            <listitem>
-                <para>Relationship information should now look like this:</para>
-            </listitem>
-        </itemizedlist>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/modeler-dbrelationship.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        <itemizedlist>
-            <listitem>
-                <para>Click "Done" to confirm the changes and close the dialog.</para>
-            </listitem>
-            <listitem>
-                <para>Two complimentary relationships have been created - from ARTIST to PAINTING
-                    and back. Still you may have noticed one thing is missing - "paintings"
-                    relationship should be to-many, but "To Many" checkbox is not checked. Let's
-                    change that - check the checkbox for "paintings" relationship, and then click on
-                    PAINTING DbEntity, and uncheck "artist" relationship "To Many" to make the
-                    reverse relationship "to-one" as it should be.</para>
-            </listitem>
-            <listitem>
-                <para>Repeat the steps above to create a many-to-one relationship from PAINTING to
-                    GALLERY, calling the relationships pair "gallery" and "paintings".</para>
-            </listitem>
-        </itemizedlist>
-    </section>
-    <section xml:id="mapping-java-classes">
-        <title>Mapping Java Classes</title>
-        <para>Now that the database schema mapping is complete, CayenneModeler can create mappings
-            of Java classes (aka "ObjEntities") by deriving everything from DbEntities. At present
-            there is no way to do it for the entire DataMap in one click, so we'll do it for each
-            table individually.</para>
-        <itemizedlist>
-            <listitem>
-                <para>Select "ARTIST" DbEntity and click on "Create ObjEntity" button (a green class
-                    icon) either on the entity toolbar or on the main toolbar. An ObjEntity called
-                    "Artist" is created with a Java class field set to
-                    "org.example.cayenne.persistent.Artist". The modeler transformed the database
-                    names to the Java-friendly names (e.g., if you click on the "Attributes" tab,
-                    you'll see that "DATE_OF_BIRTH" column was converted to "dateOfBirth" Java class
-                    attribute).</para>
-            </listitem>
-            <listitem>
-                <para>Select "GALLERY" DbEntity and click on "Create ObjEntity" button again -
-                    you'll see a "Gallery" ObjEntity created.</para>
-            </listitem>
-            <listitem>
-                <para>Finally, do the same thing for "PAINTING".</para>
-            </listitem>
-        </itemizedlist>
-        <para>Now you need to synchronize relationships. Artist and Gallery entities were created
-            when there was no related "Painting" entity, so their relationships were not set. <itemizedlist>
-                <listitem>
-                    <para>Click on the "Artist" ObjEntity and (optinally) change to the
-                        "Relationships" tab. Now click on "Sync ObjEntity with DbEntity" button on
-                        the toolbar (two yellow arrows) - you will see the "paintings" relationship
-                        appear.</para>
-                </listitem>
-                <listitem>
-                    <para>Do the same for the "Gallery" entity.</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>Unless you want to customize the Java class and property names (which you can do
-            easily) the mapping is complete. </para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/part1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/part1.xml b/docs/docbook/getting-started/src/docbkx/part1.xml
deleted file mode 100644
index e80d03d..0000000
--- a/docs/docbook/getting-started/src/docbkx/part1.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-part1" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Setting up the environment</title>
-    <xi:include href="setup.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/part2.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/part2.xml b/docs/docbook/getting-started/src/docbkx/part2.xml
deleted file mode 100644
index f3fb46b..0000000
--- a/docs/docbook/getting-started/src/docbkx/part2.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<part xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-part2" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Learning mapping basics</title>
-    <xi:include href="starting-project.xml"/>
-    <xi:include href="object-relational-mapping.xml"/>
-    <xi:include href="java-classes.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/part3.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/part3.xml b/docs/docbook/getting-started/src/docbkx/part3.xml
deleted file mode 100644
index bb2805f..0000000
--- a/docs/docbook/getting-started/src/docbkx/part3.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<part xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-part3" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Learning Cayenne API</title>
-    <xi:include href="object-context.xml"/>
-    <xi:include href="persistent-objects.xml"/>
-    <xi:include href="select-query.xml"/>
-    <xi:include href="delete.xml"/>
-</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/part4.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/part4.xml b/docs/docbook/getting-started/src/docbkx/part4.xml
deleted file mode 100644
index c38cfc2..0000000
--- a/docs/docbook/getting-started/src/docbkx/part4.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
--->
-<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="getting-started-part4" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <title>Converting to Web Application</title>
-    <xi:include href="webapp.xml"/>
-</part>
-

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/persistent-objects.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/persistent-objects.xml b/docs/docbook/getting-started/src/docbkx/persistent-objects.xml
deleted file mode 100644
index e1943e3..0000000
--- a/docs/docbook/getting-started/src/docbkx/persistent-objects.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Getting started with persistent objects</title>
-    <para>In this chapter we'll learn about persistent objects, how to customize them and how to
-        create and save them in DB.</para>
-    <section xml:id="customizing-persistent-objects">
-        <title>Inspecting and Customizing Persistent Objects</title>
-        <para>Persistent classes in Cayenne implement a DataObject interface. If you inspect any of
-            the classes generated earlier in this tutorial (e.g.
-            org.example.cayenne.persistent.Artist), you'll see that it extends a class with the name
-            that starts with underscore (org.example.cayenne.persistent.auto._Artist), which in turn
-            extends from org.apache.cayenne.CayenneDataObject. Splitting each persistent class into
-            user-customizable subclass (Xyz) and a generated superclass (_Xyz) is a useful technique
-            to avoid overwriting the custom code when refreshing classes from the mapping
-            model.</para>
-        <para>Let's for instance add a utility method to the Artist class that sets Artist date of
-            birth, taking a string argument for the date. It will be preserved even if the model
-            changes later:</para>
-        <programlisting language="java">package org.example.cayenne.persistent;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.example.cayenne.persistent.auto._Artist;
-
-public class Artist extends _Artist {
-
-    static final String DEFAULT_DATE_FORMAT = "yyyyMMdd";
-
-    /**
-     * Sets date of birth using a string in format yyyyMMdd.
-     */
-    public void setDateOfBirthString(String yearMonthDay) {
-        if (yearMonthDay == null) {
-            setDateOfBirth(null);
-        } else {
-
-            Date date;
-            try {
-                date = new SimpleDateFormat(DEFAULT_DATE_FORMAT)
-                        .parse(yearMonthDay);
-            } catch (ParseException e) {
-                throw new IllegalArgumentException(
-                        "A date argument must be in format '"
-                        + DEFAULT_DATE_FORMAT + "': " + yearMonthDay);
-            }
-
-            setDateOfBirth(date);
-        }
-    }
-}</programlisting>
-    </section>
-    <section xml:id="create-new-objects">
-        <title>Create New Objects</title>
-        <para>Now we'll create a bunch of objects and save them to the database. An object is
-            created and registered with ObjectContext using "newObject" method. Objects <emphasis
-                role="bold">must</emphasis> be registered with DataContext to be persisted and to
-            allow setting relationships with other objects. Add this code to the "main" method of
-            the Main class:</para>
-        <programlisting language="java">Artist picasso = context.newObject(Artist.class);
-picasso.setName("Pablo Picasso");
-picasso.setDateOfBirthString("18811025");</programlisting>
-        <para>Note that at this point "picasso" object is only stored in memory and is not saved in
-            the database. Let's continue by adding a Metropolitan Museum "Gallery" object and a few
-            Picasso "Paintings":</para>
-        <programlisting language="java">Gallery metropolitan = context.newObject(Gallery.class);
-metropolitan.setName("Metropolitan Museum of Art"); 
-
-Painting girl = context.newObject(Painting.class);
-girl.setName("Girl Reading at a Table");
-        
-Painting stein = context.newObject(Painting.class);
-stein.setName("Gertrude Stein");</programlisting>
-        <para>Now we can link the objects together, establishing relationships. Note that in each
-            case below relationships are automatically estabslished in both directions (e.g.
-            picasso.addToPaintings(girl) has exactly the same effect as
-            girl.setToArtist(picasso)).</para>
-        <programlisting language="java">picasso.addToPaintings(girl);
-picasso.addToPaintings(stein);
-        
-girl.setGallery(metropolitan);
-stein.setGallery(metropolitan);</programlisting>
-        <para>Now lets save all five new objects, in a single method call:</para>
-        <programlisting language="java">context.commitChanges();</programlisting>
-        <para>Now you can run the application again as described in the previous chapter. The new
-            output will show a few actual DB operations:</para>
-        <programlisting>org.apache.cayenne.configuration.XMLDataChannelDescriptorLoader load
-INFO: Loading XML configuration resource from file:cayenne-project.xml
-... 
-INFO: Opening connection: jdbc:derby:memory:testdb;create=true
-    Login: null
-    Password: *******
-INFO: +++ Connecting: SUCCESS.
-INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
-INFO: --- transaction started.
-INFO: No schema detected, will create mapped tables
-INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL, 
-      NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
-INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
-INFO: CREATE TABLE AUTO_PK_SUPPORT (  
-      TABLE_NAME CHAR(100) NOT NULL,  NEXT_ID BIGINT NOT NULL,  PRIMARY KEY(TABLE_NAME))
-INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'ARTIST']
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'GALLERY']
-INFO: SELECT NEXT_ID FROM AUTO_PK_SUPPORT WHERE TABLE_NAME = ? FOR UPDATE [bind: 1:'PAINTING']
-INFO: INSERT INTO GALLERY (ID, NAME) VALUES (?, ?)
-INFO: [batch bind: 1->ID:200, 2->NAME:'Metropolitan Museum of Art']
-INFO: === updated 1 row.
-INFO: INSERT INTO ARTIST (DATE_OF_BIRTH, ID, NAME) VALUES (?, ?, ?)
-INFO: [batch bind: 1->DATE_OF_BIRTH:'1881-10-25 00:00:00.0', 2->ID:200, 3->NAME:'Pablo Picasso']
-INFO: === updated 1 row.
-INFO: INSERT INTO PAINTING (ARTIST_ID, GALLERY_ID, ID, NAME) VALUES (?, ?, ?, ?)
-INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:200, 4->NAME:'Gertrude Stein']
-INFO: [batch bind: 1->ARTIST_ID:200, 2->GALLERY_ID:200, 3->ID:201, 4->NAME:'Girl Reading at a Table']
-INFO: === updated 2 rows.
-INFO: +++ transaction committed.
-</programlisting>
-        <para>So first Cayenne creates the needed tables (remember, we used
-            "CreateIfNoSchemaStrategy"). Then it runs a number of inserts, generating primary keys
-            on the fly. Not bad for just a few lines of code.</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/select-query.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/select-query.xml b/docs/docbook/getting-started/src/docbkx/select-query.xml
deleted file mode 100644
index efe9ebd..0000000
--- a/docs/docbook/getting-started/src/docbkx/select-query.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Selecting Objects</title>
-    <para>This chapter shows how to select objects from the database using SelectQuery. </para>
-    <section xml:id="introducing-select-query">
-        <title>Introducing SelectQuery</title>
-        <para>It was shown before how to persist new objects. Cayenne queries are used to access
-            already saved objects. The primary query type used for selecting objects is <emphasis
-                role="italic">SelectQuery</emphasis>. It can be mapped in CayenneModeler or created
-            via the API. We'll use the later approach in this section. We don't have too much data
-            in the database yet, but we can still demonstrate the main principles below.</para>
-        <itemizedlist>
-            <listitem>
-                <para>Select all paintings (the code, and the log output it generates):</para>
-            </listitem>
-        </itemizedlist>
-        <programlisting language="java">SelectQuery select1 = new SelectQuery(Painting.class);
-List paintings1 = context.performQuery(select1);</programlisting>
-        <programlisting>INFO: SELECT t0.GALLERY_ID, t0.ARTIST_ID, t0.NAME, t0.ID FROM PAINTING t0
-INFO: === returned 2 rows. - took 18 ms.</programlisting>
-        <itemizedlist>
-            <listitem>
-                <para>Select paintings that start with "gi", ignoring case:</para>
-            </listitem>
-        </itemizedlist>
-        <programlisting language="java">Expression qualifier2 = ExpressionFactory.likeIgnoreCaseExp(
-                Painting.NAME_PROPERTY,
-                "gi%");
-SelectQuery select2 = new SelectQuery(Painting.class, qualifier2);
-List paintings2 = context.performQuery(select2);</programlisting>
-        <programlisting>INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 WHERE UPPER(t0.NAME) LIKE UPPER(?)
-      [bind: 1->NAME:'gi%'] - prepared in 6 ms.
-INFO: === returned 1 row. - took 18 ms.</programlisting>
-        <itemizedlist>
-            <listitem>
-                <para>Select all paintings done by artists who were born more than a 100 years ago
-                    (demonstrating using Expression.fromString(..) instead of
-                    ExpressionFactory):</para>
-            </listitem>
-        </itemizedlist>
-        <programlisting language="java">Calendar c = new GregorianCalendar();
-c.set(c.get(Calendar.YEAR) - 100, 0, 1, 0, 0, 0);
-
-Expression qualifier3 = Expression.fromString("artist.dateOfBirth &lt; $date");
-qualifier3 = qualifier3.expWithParameters(Collections.singletonMap("date", c.getTime()));
-SelectQuery select3 = new SelectQuery(Painting.class, qualifier3);
-List paintings3 = context.performQuery(select3);</programlisting>
-        <programlisting>INFO: SELECT t0.GALLERY_ID, t0.NAME, t0.ARTIST_ID, t0.ID FROM PAINTING t0 JOIN ARTIST t1 ON (t0.ARTIST_ID = t1.ID)
-      WHERE t1.DATE_OF_BIRTH &lt; ? [bind: 1->DATE_OF_BIRTH:'1911-01-01 00:00:00.493'] - prepared in 7 ms.
-INFO: === returned 2 rows. - took 25 ms.</programlisting>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/setup.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/setup.xml b/docs/docbook/getting-started/src/docbkx/setup.xml
deleted file mode 100644
index e87877c..0000000
--- a/docs/docbook/getting-started/src/docbkx/setup.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Setup</title>
-    <para> The goal of this chapter of the tutorial is to install (or check that you already have
-        installed) a minimally needed set of software to build a Cayenne application. </para>
-    <section xml:id="install-java">
-        <title>Install Java</title>
-        <para>
-            Obviously, JDK has to be installed. Cayenne 3.1 requires JDK 1.5 or newer.
-        </para>
-    </section>
-    <section xml:id="install-eclipse-and-maven">
-        <title>Install Eclipse IDE and the Maven Plugin</title>
-        <para> Download Eclipse. This tutorial is based on the Galileo package (Eclipse 3.5), JEE
-            edition, still it should work with any recent vanilla Eclipse distribution. </para>
-        <para> After downloading Eclipse, unpack it somewhere in the filesystem, and start it. The
-            only plugin that you need for the tutorial is m2eclipse. To install it, in Eclipse go to
-            "Help > Install New Software", then click on "Add.." to add a new download site, and
-            enter "Maven" in the "Name" field, and "<emphasis role="italic"
-                >http://m2eclipse.sonatype.org/sites/m2e</emphasis>" in the "Location" field. You
-            may install any of the optional components that you think you need, but for this
-            tutorial we only select a few basic components as shown on the following screenshot: </para>
-        <para>
-            <inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/maven-plugin-install.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        <para>
-            From here follow the Eclipse dialog instructions to finish the installation.
-        </para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/starting-project.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/starting-project.xml b/docs/docbook/getting-started/src/docbkx/starting-project.xml
deleted file mode 100644
index c4ea8a7..0000000
--- a/docs/docbook/getting-started/src/docbkx/starting-project.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Starting a project</title>
-    <para>
-        The goal of this chapter is to create a new Java project in Eclipse 
-        containing a basic Cayenne mapping. It presents an introduction to 
-        CayenneModeler GUI tool, showing how to create the initial mapping 
-        objects: DataDomain, DataNode, DataMap.
-    </para>
-    <section xml:id="create-new-project">
-        <title>Create a new Project in Eclipse </title>
-        <para>
-            In Eclipse select "File > New > Other..." and then "Maven > 
-            Maven Project". Click "Next". On the following screen check 
-            "Create a simple project" checkbox and click "Next" again. 
-            In the dialog shown on the screenshot below, fill the "Group Id" 
-            and "Artifact Id" fields and click "Finish". 
-        </para>
-        <para>
-            <inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/tutorial-eclipse-project.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject>
-        </para>
-        <para>
-            Now you should have a new empty project in the Eclipse workspace. 
-            Check that the project Java compiler settings are correct. Rightclick 
-            on the "tutorial" project, select "Properties > Java Compiler" and 
-            ensure that "Compiler compliance level" is at least "1.5" 
-            (some versions of Maven plugin seem to be setting it to 1.4 by default).
-        </para>
-    </section>
-    <section xml:id="download-and-start-cayenne-modeler">
-        <title>Download and Start CayenneModeler</title>
-        <para>
-            Although later in this tutorial we'll be using Maven to include Cayenne 
-            runtime jars in the project, you'll still need to download Cayenne to 
-            get access to the CayenneModeler tool. 
-        </para>
-        <para>
-            <note><para>If you are really into Maven, you can start
-                CayenneModeler from Maven too. We'll do it in a more traditional way
-                here.</para></note>
-        </para>
-        <para> Download the latest release. Unpack the distribution somewhere in the file system and
-            start CayenneModeler, following platform-specific instructions. On most platforms it is
-            done simply by doubleclicking the Modeler icon. The welcome screen of the Modeler looks
-            like this: </para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/modeler-started.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-    </section>
-    <section xml:id="create-new-mapping-project">
-        <title>Create a New Mapping Project in CayenneModeler</title>
-        <para>Click on the "New Project" button on Welcome screen. A new mapping project will appear
-            that contains a single <emphasis role="bold">DataDomain</emphasis>. The meaning of a
-            DataDomain is explained elsewhere in the User Guide. For now it is sufficient to
-            understand that DataDomain is the root of your mapping project.</para>
-        
-    </section>
-    <section xml:id="create-datanode">
-        <title>Create a DataNode</title>
-        <para>The next project object you will create is a <emphasis role="bold"
-            >DataNode</emphasis>. DataNode is a descriptor of a single database your application
-            will connect to. Cayenne mapping project can use more than one database, but for now,
-            we'll only use one. With "project" selected on the left, click on "Create DataNode"
-            button on the toolbar (or select "Project &gt; Create DataNode" from the menu.</para>
-        <para>A new DataNode is displayed. Now you need to specify JDBC connection parameters. For
-            an in-memory Derby database you can enter the following settings: <itemizedlist>
-                <listitem>
-                    <para>JDBC Driver: org.apache.derby.jdbc.EmbeddedDriver</para>
-                </listitem>
-                <listitem>
-                    <para>DB URL: jdbc:derby:memory:testdb;create=true</para>
-                </listitem>
-            </itemizedlist></para>
-        <para>
-            <note><para>We are creating an in-memory database here. So when
-                you stop your application, all the data will be lost. In most real-life
-                cases you'll be connecting to a database that actually persists its data on
-                disk, but an in-memory DB will do for the simple tutorial.</para>
-            </note>
-        </para>
-        <para>Also you will need to change "Schema Update Strategy". Select
-            "org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy" from the dropdown, so that
-            Cayenne creates a new schema on Derby based on the ORM mapping when the application
-            starts.</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/base-datanode.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        
-    </section>
-    <section xml:id="create-datamap">
-        <title>Create a DataMap</title>
-        <para>Now you will create a <emphasis role="bold">DataMap</emphasis>. DataMap is an object
-            that holds all the mapping information. To create it, click on "Create DataMap" button
-            (or select a corresponding menu item). Note that the newly created DataMap is
-            automatically linked to the DataNode that you created in the previous step. If there is
-            more than one DataNode, you may need to link a DataMap to the correct node manually. In
-            other words a DataMap within DataDomain must point to a database described by the
-            map.</para>
-        <para>You can leave all the DataMap defaults unchanged except for one - "Java Package".
-            Enter "org.example.cayenne.persistent". This name will later be used for all persistent
-            classes.</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/base-datamap.png" scalefit="1" width="100%"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        
-    </section>
-    <section xml:id="save-project">
-        <title>Save the Project</title>
-        <para>Before you proceed with the actual mapping, let's save the project. Click on "Save"
-            button in the toolbar and navigate to the "tutorial" Eclipse project folder that was
-            created earlier in this section and its "src/main/resources" subfolder and save the
-            project there. Now go back to Eclipse, right click on "tutorial" project and select
-            "Refresh", you will see three Cayenne XML files.</para>
-        <para><inlinemediaobject>
-                <imageobject>
-                    <imagedata fileref="images/eclipse-xmlfiles.png"/>
-                </imageobject>
-            </inlinemediaobject></para>
-        <para>Note that the location of the XML files is not coincidental. Cayenne runtime looks for
-            "cayenne-*.xml" file in the application CLASSPATH and "src/main/resources" folder should
-            already be a "class folder" in Eclipse for our project (and is also a standard location
-            that Maven would copy to a jar file, if we were using Maven from command-line).</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/docbkx/webapp.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/webapp.xml b/docs/docbook/getting-started/src/docbkx/webapp.xml
deleted file mode 100644
index 8882b87..0000000
--- a/docs/docbook/getting-started/src/docbkx/webapp.xml
+++ /dev/null
@@ -1,301 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<!--
-    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.
--->
-<chapter xmlns="http://docbook.org/ns/docbook"
-    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
-    <title>Converting to Web Application</title>
-    <para>This chapter shows how to work with Cayenne in a web application.</para>
-    <section xml:id="converting-to-webapp">
-        <title>Converting Tutorial to a Web Application</title>
-        <para>The web part of the web application tutorial is done in JSP, which is the least common
-            denominator of the Java web technologies, and is intentionally simplistic from the UI
-            perspective, to concentrate on Cayenne integration aspect, rather than the interface. A
-            typical Cayenne web application works like this:</para>
-        <itemizedlist>
-            <listitem>
-                <para>Cayenne configuiration is loaded when an application context is started, using
-                    a special servlet filter.</para>
-            </listitem>
-            <listitem>
-                <para>User requests are intercepted by the filter, and the DataContext is bound to
-                    the request thread, so the application can access it easily from
-                    anywhere.</para>
-            </listitem>
-            <listitem>
-                <para>The same DataContext instance is reused within a single user session;
-                    different sessions use different DataContexts (and therefore different sets of
-                    objects). <emphasis role="italic">The context can be scoped differently
-                        depending on the app specifics. For the tutorial we'll be using a
-                        session-scoped context.</emphasis></para>
-            </listitem>
-        </itemizedlist>
-        <para>So let's convert the tutorial that we created to a web application:</para>
-        <itemizedlist>
-            <listitem>
-                <para>In Eclipse under "tutorial" project folder create a new folder
-                    "src/main/webapp/WEB-INF".</para>
-            </listitem>
-            <listitem>
-                <para>Under "WEB-INF" create a new file "web.xml" (a standard web app descriptor): </para>
-                <para>
-                    <emphasis role="bold">web.xml</emphasis>
-                    <programlisting>&lt;?xml version="1.0" encoding="utf-8"?&gt;
- &lt;!DOCTYPE web-app
-   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
-  "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;
-&lt;web-app&gt;
-    &lt;display-name&gt;Cayenne Tutorial&lt;/display-name&gt;
-
-    &lt;!-- This filter bootstraps ServerRuntime and then provides each request thread 
-         with a session-bound DataContext. Note that the name of the filter is important,
-         as it points it to the right named configuration file.
-    --&gt;
-    &lt;filter&gt;
-        &lt;filter-name&gt;cayenne-project&lt;/filter-name&gt;
-        &lt;filter-class&gt;org.apache.cayenne.configuration.web.CayenneFilter&lt;/filter-class&gt;
-    &lt;/filter&gt;
-    &lt;filter-mapping&gt;
-        &lt;filter-name&gt;cayenne-project&lt;/filter-name&gt;
-        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
-    &lt;/filter-mapping&gt;
-    &lt;welcome-file-list&gt;
-        &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
-    &lt;/welcome-file-list&gt;
-&lt;/web-app&gt;</programlisting></para>
-            </listitem>
-            <listitem>
-                <para>Create the artist browser page src/main/webapp/index.jsp file with the
-                    following contents: </para>
-                <para><emphasis role="bold">webapp/index.jsp</emphasis>
-                    <programlisting>&lt;%@ page language="java" contentType="text/html" %&gt;
-&lt;%@ page import="org.example.cayenne.persistent.*" %&gt;
-&lt;%@ page import="org.apache.cayenne.*" %&gt;
-&lt;%@ page import="org.apache.cayenne.query.*" %&gt;
-&lt;%@ page import="org.apache.cayenne.exp.*" %&gt;
-&lt;%@ page import="java.util.*" %&gt;
-
-&lt;% 
-    SelectQuery query = new SelectQuery(Artist.class);
-    query.addOrdering(Artist.NAME_PROPERTY, SortOrder.ASCENDING);
-
-    ObjectContext context = BaseContext.getThreadObjectContext();
-    List&lt;Artist&gt; artists = context.performQuery(query);
-%&gt;
-&lt;html&gt;
-    &lt;head&gt;
-        &lt;title&gt;Main&lt;/title&gt;
-    &lt;/head&gt;
-    &lt;body&gt;
-        &lt;h2&gt;Artists:&lt;/h2&gt;
-        
-        &lt;% if(artists.isEmpty()) {%&gt;
-        &lt;p&gt;No artists found&lt;/p&gt;
-        &lt;% } else { 
-            for(Artist a : artists) {
-        %&gt;
-        &lt;p&gt;&lt;a href="detail.jsp?id=&lt;%=Cayenne.intPKForObject(a)%&gt;"&gt; &lt;%=a.getName()%&gt; &lt;/a&gt;&lt;/p&gt;
-        &lt;%
-            }
-            } %&gt;
-        &lt;hr&gt;
-        &lt;p&gt;&lt;a href="detail.jsp"&gt;Create new artist...&lt;/a&gt;&lt;/p&gt;
-    &lt;/body&gt;
-&lt;/html&gt; </programlisting></para>
-            </listitem>
-            <listitem>
-                <para>Create the artist editor page src/main/webapp/detail.jsp with the following
-                    content: </para>
-                <para><emphasis role="bold">webapp/detail.jsp</emphasis>
-                    <programlisting>&lt;%@ page language="java" contentType="text/html" %&gt;
-&lt;%@ page import="org.example.cayenne.persistent.*" %&gt;
-&lt;%@ page import="org.apache.cayenne.*" %&gt;
-&lt;%@ page import="java.util.*" %&gt;
-&lt;%@ page import="java.text.*" %&gt;
-
-&lt;% 
-    ObjectContext context = BaseContext.getThreadObjectContext();
-    String id = request.getParameter("id");
-
-    // find artist for id
-    Artist artist = null;
-    if(id != null &amp;&amp; id.trim().length() &gt; 0) {
-        artist = Cayenne.objectForPK(context, Artist.class, Integer.parseInt(id));
-    }
-
-    if("POST".equals(request.getMethod())) {
-        // if no id is saved in the hidden field, we are dealing with
-        // create new artist request
-        if(artist == null) {
-            artist = context.newObject(Artist.class);
-        }
-
-        // note that in a real application we would so dome validation ...
-        // here we just hope the input is correct
-        artist.setName(request.getParameter("name"));
-        artist.setDateOfBirthString(request.getParameter("dateOfBirth"));
-
-        context.commitChanges();
-
-        response.sendRedirect("index.jsp");
-    }
-
-    if(artist == null) {
-        // create transient artist for the form response rendering
-        artist = new Artist();
-    }
-
-    String name = artist.getName() == null ? "" : artist.getName();
-    String dob = artist.getDateOfBirth() == null
-            ? "" : new SimpleDateFormat("yyyyMMdd").format(artist.getDateOfBirth());
-%&gt;
-&lt;html&gt;
-    &lt;head&gt;
-        &lt;title&gt;Artist Details&lt;/title&gt;
-    &lt;/head&gt;
-    &lt;body&gt;
-        &lt;h2&gt;Artists Details&lt;/h2&gt;
-        &lt;form name="EditArtist" action="detail.jsp" method="POST"&gt;
-            &lt;input type="hidden" name="id" value="&lt;%= id != null ? id : "" %&gt;" /&gt;
-            &lt;table border="0"&gt;
-                &lt;tr&gt;
-                    &lt;td&gt;Name:&lt;/td&gt;
-                    &lt;td&gt;&lt;input type="text" name="name" value="&lt;%= name %&gt;"/&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;
-                    &lt;td&gt;Date of Birth (yyyyMMdd):&lt;/td&gt;
-                    &lt;td&gt;&lt;input type="text" name="dateOfBirth" value="&lt;%= dob %&gt;"/&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;
-                    &lt;td&gt;&lt;/td&gt;
-                    &lt;td align="right"&gt;&lt;input type="submit" value="Save" /&gt;&lt;/td&gt;
-                &lt;/tr&gt;  
-            &lt;/table&gt;
-        &lt;/form&gt;
-    &lt;/body&gt;
-&lt;/html&gt;</programlisting></para>
-            </listitem>
-        </itemizedlist>
-    </section>
-    <section xml:id="running-webapp">
-        <title>Running Web Application</title>
-        <para>To run the web application we'll use "maven-jetty-plugin". To activate it, let's add
-            the following piece of code to the "pom.xml" file, following the "dependencies" section
-            and save the POM:</para>
-        <programlisting>&lt;build&gt;
-    &lt;plugins&gt;
-        &lt;plugin&gt;
-            &lt;groupId&gt;org.mortbay.jetty&lt;/groupId&gt;
-            &lt;artifactId&gt;maven-jetty-plugin&lt;/artifactId&gt;
-            &lt;version&gt;6.1.22&lt;/version&gt;
-        &lt;/plugin&gt;
-    &lt;/plugins&gt;
-&lt;/build&gt;</programlisting>
-        <itemizedlist>
-            <listitem>
-                <para>Go to "Run &gt; Run Configurations..." menu, select "Maven Build", right click
-                    and select "New"</para>
-            </listitem>
-            <listitem>
-                <para>Make sure you fill "Name", "Base directory" and "Goals" fields as shown on the
-                    screenshot:</para>
-                <para><inlinemediaobject>
-                        <imageobject>
-                            <imagedata fileref="images/eclipse-mvnrun.png" scalefit="1" width="100%"/>
-                        </imageobject>
-                    </inlinemediaobject></para>
-            </listitem>
-        </itemizedlist>
-        <itemizedlist>
-            <listitem>
-                <para>Click "Apply" and "Run". On the first execution it may take a few minutes for
-                    Jetty plugin to download all dependencies, but eventually you'll see the logs
-                    like this:</para>
-        <programlisting>[INFO] Scanning for projects...
-[INFO]                                                                         
-[INFO] ------------------------------------------------------------------------
-[INFO] Building tutorial 0.0.1-SNAPSHOT
-[INFO] ------------------------------------------------------------------------
-...
-[INFO] Configuring Jetty for project: tutorial
-[INFO] Webapp source directory = /.../tutorial/src/main/webapp
-[INFO] Reload Mechanic: automatic
-[INFO] Classes = /.../tutorial/target/classes
-[INFO] Context path = /tutorial
-[INFO] Tmp directory =  determined at runtime
-[INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml
-[INFO] Web overrides =  none
-[INFO] web.xml file = /.../tutorial/src/main/webapp/WEB-INF/web.xml
-[INFO] Webapp directory = /.../tutorial/src/main/webapp
-[INFO] Starting jetty 6.1.22 ...
-INFO::jetty-6.1.22
-INFO::No Transaction manager found - if your webapp requires one, please configure one.
-INFO::Started SelectChannelConnector@0.0.0.0:8080
-[INFO] Started Jetty Server</programlisting>
-                </listitem>
-        </itemizedlist>
-        <itemizedlist>
-        <listitem>
-                <para>So the Jetty container just started.</para>
-            </listitem>
-            <listitem>
-                <para>Now go to <emphasis role="italic">http://localhost:8080/tutorial/</emphasis>
-                            URL. You should see "No artists found message" in the web browser and
-                            the following output in the Eclipse console:</para>
-        <programlisting>INFO: Loading XML configuration resource from file:/.../tutorial/target/classes/cayenne-project.xml
-INFO: loading user name and password.
-INFO: Created connection pool: jdbc:derby:memory:testdb;create=true
-    Driver class: org.apache.derby.jdbc.EmbeddedDriver
-    Min. connections in the pool: 1
-    Max. connections in the pool: 1
-INFO: Opening connection: jdbc:derby:memory:testdb;create=true
-    Login: null
-    Password: *******
-INFO: +++ Connecting: SUCCESS.
-INFO: Detected and installed adapter: org.apache.cayenne.dba.derby.DerbyAdapter
-INFO: --- transaction started.
-INFO: No schema detected, will create mapped tables
-INFO: CREATE TABLE GALLERY (ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: CREATE TABLE ARTIST (DATE_OF_BIRTH DATE, ID INTEGER NOT NULL, NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: CREATE TABLE PAINTING (ARTIST_ID INTEGER, GALLERY_ID INTEGER, ID INTEGER NOT NULL, 
-      NAME VARCHAR (200), PRIMARY KEY (ID))
-INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (ARTIST_ID) REFERENCES ARTIST (ID)
-INFO: ALTER TABLE PAINTING ADD FOREIGN KEY (GALLERY_ID) REFERENCES GALLERY (ID)
-INFO: CREATE TABLE AUTO_PK_SUPPORT (  
-      TABLE_NAME CHAR(100) NOT NULL,  NEXT_ID BIGINT NOT NULL,  PRIMARY KEY(TABLE_NAME))
-INFO: DELETE FROM AUTO_PK_SUPPORT WHERE TABLE_NAME IN ('ARTIST', 'GALLERY', 'PAINTING')
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('ARTIST', 200)
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('GALLERY', 200)
-INFO: INSERT INTO AUTO_PK_SUPPORT (TABLE_NAME, NEXT_ID) VALUES ('PAINTING', 200)
-INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 ORDER BY t0.NAME - prepared in 43 ms.
-INFO: === returned 0 rows. - took 56 ms.
-INFO: +++ transaction committed.</programlisting>
-            </listitem>
-        </itemizedlist>
-        <itemizedlist>
-            <listitem>
-                <para>You can click on "Create new artist" link to create artists. Existing artists
-                    can be edited by clicking on their name:</para>
-                <para><inlinemediaobject>
-                        <imageobject>
-                            <imagedata fileref="images/firefox-webapp.png" scalefit="1" width="100%"/>
-                        </imageobject>
-                    </inlinemediaobject></para>
-            </listitem>
-        </itemizedlist>
-        <para>You are done with the tutorial!</para>
-    </section>
-</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/base-datamap.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/base-datamap.png b/docs/docbook/getting-started/src/images/base-datamap.png
deleted file mode 100644
index 98f1ffc..0000000
Binary files a/docs/docbook/getting-started/src/images/base-datamap.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/base-datanode.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/base-datanode.png b/docs/docbook/getting-started/src/images/base-datanode.png
deleted file mode 100644
index e58da99..0000000
Binary files a/docs/docbook/getting-started/src/images/base-datanode.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/database-schema.jpg
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/database-schema.jpg b/docs/docbook/getting-started/src/images/database-schema.jpg
deleted file mode 100644
index 9d4ee21..0000000
Binary files a/docs/docbook/getting-started/src/images/database-schema.jpg and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png b/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png
deleted file mode 100644
index 89d0dd2..0000000
Binary files a/docs/docbook/getting-started/src/images/eclipse-generatedclasses.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/eclipse-mvnrun.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/eclipse-mvnrun.png b/docs/docbook/getting-started/src/images/eclipse-mvnrun.png
deleted file mode 100644
index 0f517d6..0000000
Binary files a/docs/docbook/getting-started/src/images/eclipse-mvnrun.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png b/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png
deleted file mode 100644
index 7cb3856..0000000
Binary files a/docs/docbook/getting-started/src/images/eclipse-xmlfiles.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/firefox-webapp.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/firefox-webapp.png b/docs/docbook/getting-started/src/images/firefox-webapp.png
deleted file mode 100644
index 35be692..0000000
Binary files a/docs/docbook/getting-started/src/images/firefox-webapp.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/maven-plugin-install.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/maven-plugin-install.png b/docs/docbook/getting-started/src/images/maven-plugin-install.png
deleted file mode 100644
index 5091b52..0000000
Binary files a/docs/docbook/getting-started/src/images/maven-plugin-install.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/modeler-artistid.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/modeler-artistid.png b/docs/docbook/getting-started/src/images/modeler-artistid.png
deleted file mode 100644
index 287f0948..0000000
Binary files a/docs/docbook/getting-started/src/images/modeler-artistid.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/modeler-dbrelationship.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/modeler-dbrelationship.png b/docs/docbook/getting-started/src/images/modeler-dbrelationship.png
deleted file mode 100644
index 2eecb11..0000000
Binary files a/docs/docbook/getting-started/src/images/modeler-dbrelationship.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/modeler-deleterule.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/modeler-deleterule.png b/docs/docbook/getting-started/src/images/modeler-deleterule.png
deleted file mode 100644
index 243bbbb..0000000
Binary files a/docs/docbook/getting-started/src/images/modeler-deleterule.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/modeler-started.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/modeler-started.png b/docs/docbook/getting-started/src/images/modeler-started.png
deleted file mode 100644
index 5c93629..0000000
Binary files a/docs/docbook/getting-started/src/images/modeler-started.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png b/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png
deleted file mode 100644
index ef39865..0000000
Binary files a/docs/docbook/getting-started/src/images/tutorial-eclipse-project.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/pom.xml b/docs/docbook/pom.xml
deleted file mode 100644
index 4e60ba2..0000000
--- a/docs/docbook/pom.xml
+++ /dev/null
@@ -1,173 +0,0 @@
-<?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.   
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
-	<modelVersion>4.0.0</modelVersion>
-	<prerequisites>
-		<maven>3</maven>
-	</prerequisites>
-
-	<parent>
-		<groupId>org.apache.cayenne.parents</groupId>
-		<artifactId>cayenne-docs-parent</artifactId>
-		<version>3.1.3-SNAPSHOT</version>
-		<relativePath>../pom.xml</relativePath>
-	</parent>
-	
-	<modules>
-        <module>docbook-stylesheets</module>
-		<module>cayenne-guide</module>
-		<module>getting-started</module>
-		<module>getting-started-rop</module>
-		<module>upgrade-guide</module>
-    </modules>
-
-    <properties>
-        <project.stylesheetdir>${project.parent.basedir}/docbook-stylesheets/target/classes</project.stylesheetdir>
-
-        <!-- This property allows to only expose major version in the docs metadata to avoid confusing SEO -->
-        <cayenne.version.major>3.1</cayenne.version.major>
-    </properties>
-
-	<groupId>org.apache.cayenne.docs</groupId>
-	<artifactId>cayenne-docbook</artifactId>
-	<packaging>pom</packaging>
-	<name>Cayenne Docbook Documentation</name>
-
-	<distributionManagement>
-		<site>
-			<id>website</id>
-			<url>scp://people.apache.org/www/cayenne/docbook/</url>
-		</site>
-	</distributionManagement>
-	
-	<build>
-		<pluginManagement>
-			<plugins>
-				<plugin>
-					<groupId>com.agilejava.docbkx</groupId>
-					<artifactId>docbkx-maven-plugin</artifactId>
-					<version>2.0.14</version>
-					<dependencies>
-						<dependency>
-							<groupId>org.docbook</groupId>
-							<artifactId>docbook-xml</artifactId>
-							<version>4.4</version>
-							<scope>runtime</scope>
-						</dependency>
-					</dependencies>
-				</plugin>
-				<plugin>
-					<groupId>org.apache.maven.plugins</groupId>
-					<artifactId>maven-antrun-plugin</artifactId>
-					<version>1.7</version>
-				</plugin>
-				<plugin>
-					<groupId>org.apache.maven.plugins</groupId>
-					<artifactId>maven-site-plugin</artifactId>
-					<version>3.1</version>
-				</plugin>
-			</plugins>
-		</pluginManagement>
-		
-		
-		<plugins>
-			<plugin>
-				<groupId>com.agilejava.docbkx</groupId>
-				<artifactId>docbkx-maven-plugin</artifactId>
-				<configuration>
-					<xincludeSupported>true</xincludeSupported>
-					<highlightSource>true</highlightSource>
-					<targetDirectory>${basedir}/target/site/</targetDirectory>
-					<includes>index.xml</includes>				
-				</configuration>
-				<executions>
-					<execution>
-						<id>build-pdf</id>
-						<configuration>
-							<foCustomization>${project.stylesheetdir}/stylesheets/pdf.xsl</foCustomization>
-							<postProcess>
-								<delete failonerror="false">
-									<fileset dir="target/site/" includes="*.fo" />
-								</delete>
-								<move file="target/site/index.pdf" tofile="target/site/${project.artifactId}.pdf" />
-							</postProcess>
-						</configuration>
-						<phase>generate-resources</phase>
-						<goals>
-							<goal>generate-pdf</goal>
-						</goals>
-					</execution>
-					<execution>
-						<id>build-html</id>
-						<configuration>
-							<htmlCustomization>${project.stylesheetdir}/stylesheets/html.xsl</htmlCustomization>
-							<chunkedOutput>true</chunkedOutput>
-							<postProcess>
-								<copy todir="${basedir}/target/site/index/css">
-									<fileset dir="${project.stylesheetdir}/css" />
-								</copy>
-								<copy todir="${basedir}/target/site/index/images">
-									<fileset dir="${basedir}/src/images" />
-								</copy>
-							</postProcess>
-						</configuration>
-						<phase>generate-resources</phase>
-						<goals>
-							<goal>generate-html</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-site-plugin</artifactId>
-				<configuration>
-					<generateReports>false</generateReports>
-					<sourceDirectory>src</sourceDirectory>
-					<includes>index.xml</includes>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-antrun-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>cleanup-maven</id>
-						<phase>generate-resources</phase>
-						<goals>
-							<goal>run</goal>
-						</goals>
-						<configuration>
-							<target>
-								<delete failonerror="false">
-									<filelist dir="target/site/css" files="maven-base.css,maven-theme.css,print.css,site.css" />
-									<!-- collapsed.gifx is deliberately mispelt since we want to leave one image behind to avoid a maven problem with deploying a completely empty site -->
-									<filelist dir="target/site/images" files="collapsed.gifx,external.png,icon_info_sml.gif,icon_warning_sml.gif,newwindow.png,expanded.gif,icon_error_sml.gif,icon_success_sml.gif" />
-								</delete>
-								<delete dir="target/site/images/logos" failonerror="false" />
-							</target>
-						</configuration>
-
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/upgrade-guide/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/pom.xml b/docs/docbook/upgrade-guide/pom.xml
deleted file mode 100644
index 37028f2..0000000
--- a/docs/docbook/upgrade-guide/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.   
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<parent>
-		<groupId>org.apache.cayenne.docs</groupId>
-		<artifactId>cayenne-docbook</artifactId>
-		<version>3.1.3-SNAPSHOT</version>
-	</parent>
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.cayenne.docs</groupId>
-	<artifactId>upgrade-guide</artifactId>
-	<name>Docbook: Cayenne New Features and Upgrade Guide</name>
-
-	<build>
-		<resources>
-			<resource>
-				<directory>target/site</directory>
-			</resource>
-		</resources>
-	</build>
-</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7783cd34/docs/docbook/upgrade-guide/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/src/docbkx/index.xml b/docs/docbook/upgrade-guide/src/docbkx/index.xml
deleted file mode 100644
index ea4ee02..0000000
--- a/docs/docbook/upgrade-guide/src/docbkx/index.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="upgrade-guide" xmlns:xi="http://www.w3.org/2001/XInclude">
-    <info>
-        <title>Cayenne New Features and Upgrade Guide</title>
-        <copyright>
-            <year>2011-2017</year>
-            <holder>Apache Software Foundation and individual authors</holder>
-        </copyright>
-        <legalnotice>
-            <title>License</title>
-            <para>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</para>
-            
-            <para>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.</para>
-        </legalnotice>
-    </info>
-    <xi:include href="new-features.xml"/>
-</book>
-