Repository: cayenne Updated Branches: refs/heads/master 41dd56c5a -> df1324e40
http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 bab9815..0000000 --- a/docs/docbook/getting-started/src/docbkx/webapp.xml +++ /dev/null @@ -1,308 +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. ---> -<section 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 IDEA under "tutorial" project folder create a new folder - "<code>src/main/webapp/WEB-INF</code>".</para> - </listitem> - <listitem> - <para>Under "<code>WEB-INF</code>" create a new file "<code>web.xml</code>" (a standard web app descriptor): </para> - <para> - <emphasis role="bold">web.xml</emphasis> - <programlisting language="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></programlisting></para> - </listitem> - <listitem> - <para>Create the artist browser page <code>src/main/webapp/index.jsp</code> file with the - following contents: </para> - <para><emphasis role="bold">webapp/index.jsp</emphasis> - <programlisting language="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.*" %> - -<% - ObjectContext context = BaseContext.getThreadObjectContext(); - List<Artist> artists = ObjectSelect.query(Artist.class) - .orderBy(Artist.NAME.asc()) - .select(context); -%> - -<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> </programlisting></para> - </listitem> - <listitem> - <para>Create the artist editor page <code>src/main/webapp/detail.jsp</code> with the following - content: </para> - <para><emphasis role="bold">webapp/detail.jsp</emphasis> - <programlisting language="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="java.util.*" %> -<%@ page import="java.text.*" %> -<%@ page import="java.time.format.DateTimeFormatter" %> - -<% - ObjectContext context = BaseContext.getThreadObjectContext(); - String id = request.getParameter("id"); - - // find artist for id - Artist artist = null; - if(id != null && id.trim().length() > 0) { - artist = SelectById.query(Artist.class, Integer.parseInt(id)).selectOne(context); - } - - 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(); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); - String dob = artist.getDateOfBirth() == null - ? "" :artist.getDateOfBirth().format(formatter); -%> -<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></programlisting></para> - </listitem> - </itemizedlist> - </section> - <section xml:id="running-webapp"> - <title>Running Web Application</title> - <para>We need to provide javax servlet-api for our application.</para> - <programlisting language="xml"><dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - <scope>provided</scope> -</dependency></programlisting> - - <para>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 "<code>pom.xml</code>" file, following the "dependencies" - section and save the POM:</para> - <programlisting language="xml"><build> - <plugins> - <plugin> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-maven-plugin</artifactId> - <version>9.3.14.v20161028</version> - </plugin> - </plugins> -</build></programlisting> - <itemizedlist> - <listitem> - <para>Go to "Select Run/Debug Configuration" menu, and then "Edit Configuration..."</para> - <para><inlinemediaobject> - <imageobject> - <imagedata fileref="images/idea-edit-configurations.png"/> - </imageobject> - </inlinemediaobject> - </para> - </listitem> - <listitem> - <para>Click "+" button and select "Maven". Enter "Name" and "Command line" as shown on screenshot:</para> - <para><inlinemediaobject> - <imageobject> - <imagedata fileref="images/idea-run-configuration.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> - <screen>[INFO] ------------------------------------------------------------------------ -[INFO] Building tutorial 0.0.1-SNAPSHOT -[INFO] ------------------------------------------------------------------------ -... -[INFO] Configuring Jetty for project: tutorial -[INFO] webAppSourceDirectory not set. Trying src/main/webapp -[INFO] Reload Mechanic: automatic -[INFO] Classes = /.../tutorial/target/classes -[INFO] Logging initialized @1617ms -[INFO] Context path = / -[INFO] Tmp directory = /.../tutorial/target/tmp -[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml -[INFO] Web overrides = none -[INFO] web.xml file = file:/.../tutorial/src/main/webapp/WEB-INF/web.xml -[INFO] Webapp directory = /.../tutorial/src/main/webapp -[INFO] jetty-9.3.0.v20150612 -[INFO] Started o.e.j.m.p.JettyWebAppContext@6872f9c8{/,file:/.../tutorial/src/main/webapp/,AVAILABLE}{file:/.../tutorial/src/main/webapp/} -[INFO] Started ServerConnector@723875bc{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} -[INFO] Started @2367ms -[INFO] Started Jetty Server</screen> - </listitem> - </itemizedlist> - <itemizedlist> - <listitem> - <para>So the Jetty container just started.</para> - </listitem> - <listitem> - <para>Now go to <link xlink:href="http://localhost:8080/">http://localhost:8080/</link> - URL. You should see "No artists found message" in the web browser and - the following output in the IDEA console:</para> - <screen>INFO: Loading XML configuration resource from file:/.../tutorial/target/classes/cayenne-project.xml -INFO: loading user name and password. -INFO: Connecting to 'jdbc:derby:memory:testdb;create=true' as 'null' -INFO: +++ Connecting: SUCCESS. -INFO: setting DataNode 'datanode' as default, used by all unlinked DataMaps -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: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 ORDER BY t0.NAME -INFO: === returned 0 rows. - took 17 ms. -INFO: +++ transaction committed.</screen> - </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/chrome-webapp.png" scalefit="1" width="100%"/> - </imageobject> - </inlinemediaobject></para> - </listitem> - </itemizedlist> - <para>You are done with the tutorial!</para> - </section> -</section> http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 a12bc01..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/df1324e4/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 69939bb..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/df1324e4/docs/docbook/getting-started/src/images/chrome-webapp.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/chrome-webapp.png b/docs/docbook/getting-started/src/images/chrome-webapp.png deleted file mode 100644 index 603e1df..0000000 Binary files a/docs/docbook/getting-started/src/images/chrome-webapp.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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/df1324e4/docs/docbook/getting-started/src/images/icon-attribute.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-attribute.png b/docs/docbook/getting-started/src/images/icon-attribute.png deleted file mode 100755 index 77a68eb..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-attribute.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-datamap.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-datamap.png b/docs/docbook/getting-started/src/images/icon-datamap.png deleted file mode 100755 index 2ea96ca..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-datamap.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-dbentity.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-dbentity.png b/docs/docbook/getting-started/src/images/icon-dbentity.png deleted file mode 100755 index 87d9d8a..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-dbentity.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-edit.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-edit.png b/docs/docbook/getting-started/src/images/icon-edit.png deleted file mode 100755 index 027c482..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-edit.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-new_objentity.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-new_objentity.png b/docs/docbook/getting-started/src/images/icon-new_objentity.png deleted file mode 100755 index 8735d7a..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-new_objentity.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-node.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-node.png b/docs/docbook/getting-started/src/images/icon-node.png deleted file mode 100755 index 2ff4383..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-node.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-relationship.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-relationship.png b/docs/docbook/getting-started/src/images/icon-relationship.png deleted file mode 100755 index 44ed7eb..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-relationship.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/icon-sync.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/icon-sync.png b/docs/docbook/getting-started/src/images/icon-sync.png deleted file mode 100755 index 03e8623..0000000 Binary files a/docs/docbook/getting-started/src/images/icon-sync.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/idea-edit-configurations.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/idea-edit-configurations.png b/docs/docbook/getting-started/src/images/idea-edit-configurations.png deleted file mode 100644 index df1d524..0000000 Binary files a/docs/docbook/getting-started/src/images/idea-edit-configurations.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/idea-file-run-menu.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/idea-file-run-menu.png b/docs/docbook/getting-started/src/images/idea-file-run-menu.png deleted file mode 100644 index 30cf05e..0000000 Binary files a/docs/docbook/getting-started/src/images/idea-file-run-menu.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/idea-generated-classes.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/idea-generated-classes.png b/docs/docbook/getting-started/src/images/idea-generated-classes.png deleted file mode 100644 index 504dce5..0000000 Binary files a/docs/docbook/getting-started/src/images/idea-generated-classes.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/idea-run-configuration.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/idea-run-configuration.png b/docs/docbook/getting-started/src/images/idea-run-configuration.png deleted file mode 100644 index 3ebbb62..0000000 Binary files a/docs/docbook/getting-started/src/images/idea-run-configuration.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/getting-started/src/images/idea-xmlfiles.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/idea-xmlfiles.png b/docs/docbook/getting-started/src/images/idea-xmlfiles.png deleted file mode 100644 index 1b4707d..0000000 Binary files a/docs/docbook/getting-started/src/images/idea-xmlfiles.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 fb8c1dd..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/df1324e4/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 4b23eb5..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/df1324e4/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 86ada13..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/df1324e4/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 dbf8324..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/df1324e4/docs/docbook/getting-started/src/images/tutorial-idea-project.png ---------------------------------------------------------------------- diff --git a/docs/docbook/getting-started/src/images/tutorial-idea-project.png b/docs/docbook/getting-started/src/images/tutorial-idea-project.png deleted file mode 100644 index 058dc1d..0000000 Binary files a/docs/docbook/getting-started/src/images/tutorial-idea-project.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/docs/docbook/pom.xml ---------------------------------------------------------------------- diff --git a/docs/docbook/pom.xml b/docs/docbook/pom.xml deleted file mode 100644 index 3d0ad1a..0000000 --- a/docs/docbook/pom.xml +++ /dev/null @@ -1,126 +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.docs</groupId> - <artifactId>cayenne-docs-parent</artifactId> - <version>4.1.M2-SNAPSHOT</version> - </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>4.1</cayenne.version.major> - </properties> - - <artifactId>cayenne-docbook</artifactId> - <packaging>pom</packaging> - <name>cayenne-docbook: Cayenne Docbook Documentation</name> - - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>com.agilejava.docbkx</groupId> - <artifactId>docbkx-maven-plugin</artifactId> - <version>2.0.17</version> - <dependencies> - <dependency> - <groupId>org.docbook</groupId> - <artifactId>docbook-xml</artifactId> - <version>4.4</version> - <scope>runtime</scope> - </dependency> - </dependencies> - </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> - <move todir="${basedir}/target/site/index"> - <fileset dir="${basedir}/target/site/"> - <include name="*.html" /> - </fileset> - </move> - <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> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 fd7ba98..0000000 --- a/docs/docbook/upgrade-guide/pom.xml +++ /dev/null @@ -1,38 +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>4.1.M2-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>upgrade-guide</artifactId> - <name>upgrade-guide: 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/df1324e4/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 e9fd95c..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 4.1 New Features and Upgrade Guide</title> - <copyright> - <year>2011-<?dbtimestamp format="Y"?></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> - http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 78741c9..0000000 --- a/docs/docbook/upgrade-guide/src/docbkx/new-features.xml +++ /dev/null @@ -1,25 +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" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd"> - <title>Guide to 4.1 Features</title> - <para>This guide highlights the new features and changes introduced in Apache Cayenne 4.0. For a full list of changes consult - RELEASE-NOTES.txt included in Cayenne download. For release-specific upgrade instructions check UPGRADE.txt.</para> - - <para>TODO</para> -</article> http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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/df1324e4/docs/pom.xml ---------------------------------------------------------------------- diff --git a/docs/pom.xml b/docs/pom.xml index d0c8e89..068d9e5 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -30,13 +30,13 @@ <groupId>org.apache.cayenne.docs</groupId> <artifactId>cayenne-docs-parent</artifactId> - <name>cayenne-docs-parent: Cayenne Documenation Parent</name> + <name>cayenne-docs-parent: Cayenne Documentation Parent</name> <packaging>pom</packaging> <modules> <module>doc</module> - <module>docbook</module> - </modules> + <module>asciidoc</module> + </modules> <build> <plugins> http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 923c014..46f3525 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 @@ -48,29 +48,34 @@ 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"); - Painting girl = context.newObject(Painting.class); girl.setName("Girl Reading at a Table"); - 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/df1324e4/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 318ceb0..f42e721 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. ****************************************************************/ +// This code used in docs too, so it should be formatted +// to 80 char line to fit in PDF. package org.apache.cayenne.tutorial.persistent; import java.time.LocalDate; @@ -24,27 +26,31 @@ import java.time.format.DateTimeParseException; import org.apache.cayenne.tutorial.persistent.auto._Artist; +// tag::content[] public class Artist extends _Artist { - static final String DEFAULT_DATE_FORMAT = "yyyyMMdd"; + 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 { + /** + * Sets date of birth using a string in format yyyyMMdd. + */ + public void setDateOfBirthString(String yearMonthDay) { + if (yearMonthDay == null) { + setDateOfBirth(null); + return; + } - LocalDate date; - try { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DEFAULT_DATE_FORMAT); - date = LocalDate.parse(yearMonthDay, formatter); - } catch (DateTimeParseException e) { - throw new IllegalArgumentException("A date argument must be in format '" - + DEFAULT_DATE_FORMAT + "': " + yearMonthDay); - } - setDateOfBirth(date); - } - } + LocalDate date; + try { + DateTimeFormatter formatter = DateTimeFormatter + .ofPattern(DEFAULT_DATE_FORMAT); + date = LocalDate.parse(yearMonthDay, formatter); + } catch (DateTimeParseException e) { + throw new IllegalArgumentException( + "A date argument must be in format '" + + DEFAULT_DATE_FORMAT + "': " + yearMonthDay); + } + setDateOfBirth(date); + } } +// end::content[] http://git-wip-us.apache.org/repos/asf/cayenne/blob/df1324e4/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 448a8eb..86e51d6 100644 --- a/tutorials/tutorial/src/main/webapp/detail.jsp +++ b/tutorials/tutorial/src/main/webapp/detail.jsp @@ -21,9 +21,9 @@ <%@ page language="java" contentType="text/html" %> <%@ page import="org.apache.cayenne.tutorial.persistent.*" %> <%@ page import="org.apache.cayenne.*" %> -<%@ page import="java.text.*" %> <%@ page import="java.time.format.DateTimeFormatter"%> +// tag::content[] <% ObjectContext context = BaseContext.getThreadObjectContext(); String id = request.getParameter("id"); @@ -85,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/df1324e4/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 36f630e..915221b 100644 --- a/tutorials/tutorial/src/main/webapp/index.jsp +++ b/tutorials/tutorial/src/main/webapp/index.jsp @@ -18,13 +18,12 @@ * under the License. ****************************************************************/ --> -<%@ page language="java" contentType="text/html" %> +<%@ page contentType="text/html" %> <%@ page import="org.apache.cayenne.tutorial.persistent.*" %> <%@ page import="org.apache.cayenne.*" %> <%@ page import="org.apache.cayenne.query.*" %> -<%@ page import="org.apache.cayenne.exp.*" %> <%@ page import="java.util.*" %> - +// tag::content[] <% ObjectContext context = BaseContext.getThreadObjectContext(); List<Artist> artists = ObjectSelect.query(Artist.class) @@ -50,4 +49,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
