You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2011/08/27 14:52:54 UTC

svn commit: r1162337 - in /cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx: ch5.xml index.xml part1.xml part2.xml part3.xml

Author: aadamchik
Date: Sat Aug 27 12:52:53 2011
New Revision: 1162337

URL: http://svn.apache.org/viewvc?rev=1162337&view=rev
Log:
docbook:

* better doc ids
* starting Cayenne - in progress

Modified:
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/ch5.xml
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/index.xml
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part1.xml
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part2.xml
    cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part3.xml

Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/ch5.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/ch5.xml?rev=1162337&r1=1162336&r2=1162337&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/ch5.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/ch5.xml Sat Aug 27 12:52:53 2011
@@ -3,7 +3,35 @@
 	version="5.0" xml:id="starting-cayenne">
 	<title>Starting Cayenne</title>
 	<section xml:id="starting-serverruntime">
-		<title>Starting ServerRuntime</title>
+		<title>Starting and Stopping ServerRuntime</title>
+		<para>In runtime Cayenne is accessed via org.apache.cayenne.configuration.server.ServerRuntime.
+			ServerRuntime is created simply by calling a
+			constructor:<programlisting>ServerRuntime runtime = new ServerRuntime("com/example/cayenne-mydomain.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 example 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 DI 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 certain internal
+			Cayenne service (in this case - QueryCache) with a different
+			class:<programlisting>public class MyExtensionsModule implements Module {
+	public void configure(Binder binder) {
+		binder.bind(QueryCache.class).to(EhCacheQueryCache.class);
+	}	
+}</programlisting><programlisting>Module extensions = new MyExtensionsModule();
+ServerRuntime runtime = new ServerRuntime("com/example/cayenne-mydomain.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>runtime.shutdwon();</programlisting>When a runtime object has the same
+			scope as the application, this may not be absolutely necessary, however in some cases it
+			is essential, and is generally considered a good practice. E.g. web container hot
+			redeploy will cause resource leaks and eventual OutOfMemoryError if web applications
+			fail to shutdown CayenneRuntime.</para>
 	</section>
 	<section xml:id="webapps">
 		<title>Web Applications</title>

Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/index.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/index.xml?rev=1162337&r1=1162336&r2=1162337&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/index.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/index.xml Sat Aug 27 12:52:53 2011
@@ -1,6 +1,6 @@
 <?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="manual"
-	xmlns:xi="http://www.w3.org/2001/XInclude">
+<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>

Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part1.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part1.xml?rev=1162337&r1=1162336&r2=1162337&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part1.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part1.xml Sat Aug 27 12:52:53 2011
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-        xml:id="part1" xmlns:xi="http://www.w3.org/2001/XInclude">
+        xml:id="cayenne-guide-part1" xmlns:xi="http://www.w3.org/2001/XInclude">
         <title>Object Relational Mapping with Cayenne</title>
         <xi:include href="ch1.xml"/>
 		<xi:include href="ch2.xml"/>

Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part2.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part2.xml?rev=1162337&r1=1162336&r2=1162337&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part2.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part2.xml Sat Aug 27 12:52:53 2011
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-        xml:id="part2" xmlns:xi="http://www.w3.org/2001/XInclude">
+        xml:id="cayenne-guide-part2" xmlns:xi="http://www.w3.org/2001/XInclude">
         <title>Cayenne Framework</title>
         <xi:include href="ch4.xml"/>
 		<xi:include href="ch5.xml"/>

Modified: cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part3.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part3.xml?rev=1162337&r1=1162336&r2=1162337&view=diff
==============================================================================
--- cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part3.xml (original)
+++ cayenne/main/trunk/docs/docbook/cayenne-guide/src/docbkx/part3.xml Sat Aug 27 12:52:53 2011
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-        xml:id="part3" xmlns:xi="http://www.w3.org/2001/XInclude">
+        xml:id="cayenne-guide-part3" xmlns:xi="http://www.w3.org/2001/XInclude">
         <title>Cayenne Framework - Remote Object Persistence </title>
         <xi:include href="ch12.xml"/>
 		<xi:include href="ch13.xml"/>