Author: jukka
Date: Tue Jan 1 16:37:21 2008
New Revision: 607952
URL: http://svn.apache.org/viewvc?rev=607952&view=rev
Log:
JCR-1281: Use spaces for indentation in ocm docs
- Also trimmed spaces at the end of lines
Modified:
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-beans-strategy.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-collections-strategy.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/inheritance-interface-strategies.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/introduction-strategies.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/api-intro.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/basic-operations.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/locking.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/search.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/versionning.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-configuration.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-introduction.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-setup.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-spring.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/index.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/introduction-strategies.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/navigation.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/atomic-strategy.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/bean-strategy.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/collection-strategy.xml
jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/introduction-strategies.xml
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,67 +16,67 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Advanced Mapping Strategies</title>
- </properties>
- <body>
-
- <section name="Advanced Mapping Strategies">
- <subsection name="Inheritance">
- </subsection>
-
- <subsection name="Interface">
- </subsection>
- <subsection name="Components">
-
-
- <p>A component is an entity that cannot live by its own, but has a logical
- meaning. Take for example an Address. It may live alone, but doesn't make much sense in some
- systems. Once associated with an User it starts making sense. Now, as in RDBMS you can choose the
- persist this as a record in a separate table with a 1-1 relation, or you may choose to persist
- Address field along with the User.
-
- Now, returning to JCR, the component is fitting perfectly the mixin notion. A mixin cannot live by
- its own in the repository. It is associated with some node. It's properties are added to the set of
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Advanced Mapping Strategies</title>
+ </properties>
+ <body>
+
+ <section name="Advanced Mapping Strategies">
+ <subsection name="Inheritance">
+ </subsection>
+
+ <subsection name="Interface">
+ </subsection>
+ <subsection name="Components">
+
+
+ <p>A component is an entity that cannot live by its own, but has a logical
+ meaning. Take for example an Address. It may live alone, but doesn't make much sense in some
+ systems. Once associated with an User it starts making sense. Now, as in RDBMS you can choose the
+ persist this as a record in a separate table with a 1-1 relation, or you may choose to persist
+ Address field along with the User.
+
+ Now, returning to JCR, the component is fitting perfectly the mixin notion. A mixin cannot live by
+ its own in the repository. It is associated with some node. It's properties are added to the set of
original node.
- </p>
- </subsection>
- <subsection name ="Group some bean attributes into a subnode">
- </subsection>
- <subsection name ="Map to another node structure">
- <p>Sometime, it should be interesting to map to a different jcr node structure.
- Here is an example, for a class "File", we can have :</p>
- <source><![CDATA[
+ </p>
+ </subsection>
+ <subsection name ="Group some bean attributes into a subnode">
+ </subsection>
+ <subsection name ="Map to another node structure">
+ <p>Sometime, it should be interesting to map to a different jcr node structure.
+ Here is an example, for a class "File", we can have :</p>
+ <source><![CDATA[
public class File
-
+
{
-
-
- private String mimeType;
- private String encoding;
- private InputStream data;
- private Calendar lastModified;
- // Add getters/setters
+
+
+ private String mimeType;
+ private String encoding;
+ private InputStream data;
+ private Calendar lastModified;
+ // Add getters/setters
}
- ]]></source>
-
- <p>and in terms of JCR structure, we can have :</p>
- <source><![CDATA[
-
+ ]]></source>
+
+ <p>and in terms of JCR structure, we can have :</p>
+ <source><![CDATA[
+
nt:file
- jcr:content
- jcr:mimeType
- jcr:encoding
- jcr:data
- jcr:lastModified
- ]]></source>
- So, the jcr:content node is an extra node to specify in the mapping file.
-
- </subsection>
- <subsection name ="">
- </subsection>
-
- </section>
- </body>
+ jcr:content
+ jcr:mimeType
+ jcr:encoding
+ jcr:data
+ jcr:lastModified
+ ]]></source>
+ So, the jcr:content node is an extra node to specify in the mapping file.
+
+ </subsection>
+ <subsection name ="">
+ </subsection>
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-beans-strategy.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-beans-strategy.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-beans-strategy.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-beans-strategy.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,13 +16,13 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Introduction to the Mapping Strategies</title>
- </properties>
- <body>
- <section name="Advanced Bean Strategies">
- <p>We are currently working on the advanced mapping strategies.</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Introduction to the Mapping Strategies</title>
+ </properties>
+ <body>
+ <section name="Advanced Bean Strategies">
+ <p>We are currently working on the advanced mapping strategies.</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-collections-strategy.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-collections-strategy.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-collections-strategy.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/advanced-collections-strategy.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,13 +16,13 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Introduction to the Mapping Strategies</title>
- </properties>
- <body>
- <section name="Advanced Collection Strategies">
- <p>We are currently working on the advanced mapping strategies.</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Introduction to the Mapping Strategies</title>
+ </properties>
+ <body>
+ <section name="Advanced Collection Strategies">
+ <p>We are currently working on the advanced mapping strategies.</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/inheritance-interface-strategies.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/inheritance-interface-strategies.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/inheritance-interface-strategies.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/inheritance-interface-strategies.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,13 +16,13 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Introduction to the Mapping Strategies</title>
- </properties>
- <body>
- <section name="Inheritances and Intefaces">
- <p>We are currently working on the advanced mapping strategies.</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Introduction to the Mapping Strategies</title>
+ </properties>
+ <body>
+ <section name="Inheritances and Intefaces">
+ <p>We are currently working on the advanced mapping strategies.</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/introduction-strategies.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/introduction-strategies.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/introduction-strategies.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/advanced-strategies/introduction-strategies.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,13 +16,13 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Introduction to the Mapping Strategies</title>
- </properties>
- <body>
- <section name="Introduction to the Advanced Mapping Strategies">
- <p>We are currently working on the advanced mapping strategies.</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Introduction to the Mapping Strategies</title>
+ </properties>
+ <body>
+ <section name="Introduction to the Advanced Mapping Strategies">
+ <p>We are currently working on the advanced mapping strategies.</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/api-intro.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/api-intro.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/api-intro.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/api-intro.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,27 +16,27 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>The Persistence Manager API</title>
- </properties>
- <body>
-
- <section name="API Overview">
-
- <p>With the current Persistence Manager API, it is possible to :
- <ul>
- <li>Manage the object life cycle (insert, update, delete, retrieve).</li>
- <li>Search single object or collections with criteria.</li>
- <li>Manage versions (check int, check out, create a new version, show history).</li>
- <li>Lock objects.</li>
- </ul>
- </p>
- <p>
- You can see the <a href="../apidocs/org/apache/portals/graffito/jcr/persistence/PersistenceManager.html">JavaDoc</a> to get a complete API overview.
- </p>
- <p>We plan to add other features in a future release.</p>
-
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>The Persistence Manager API</title>
+ </properties>
+ <body>
+
+ <section name="API Overview">
+
+ <p>With the current Persistence Manager API, it is possible to :
+ <ul>
+ <li>Manage the object life cycle (insert, update, delete, retrieve).</li>
+ <li>Search single object or collections with criteria.</li>
+ <li>Manage versions (check int, check out, create a new version, show history).</li>
+ <li>Lock objects.</li>
+ </ul>
+ </p>
+ <p>
+ You can see the <a href="../apidocs/org/apache/portals/graffito/jcr/persistence/PersistenceManager.html">JavaDoc</a> to get a complete API overview.
+ </p>
+ <p>We plan to add other features in a future release.</p>
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/basic-operations.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/basic-operations.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/basic-operations.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/basic-operations.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,64 +16,64 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>The Persistence Manager API</title>
- </properties>
- <body>
- <section name="The Basic Operations">
- <p>
- When you have <a href="../engine-setup.html">create a new Persistence Manager</a> in your application, you can use this component to insert, update, delete and retrieve objects. The class 'Folder' used in the following sections should be associated to a class-descriptor defined in the mapping descriptor.
- </p>
- <p>
- This page describes only the main Persistence Manager methods. You can see the javadoc to get more information on the API.
- </p>
-
-
- <subsection name="Insert">
- <p>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>The Persistence Manager API</title>
+ </properties>
+ <body>
+ <section name="The Basic Operations">
+ <p>
+ When you have <a href="../engine-setup.html">create a new Persistence Manager</a> in your application, you can use this component to insert, update, delete and retrieve objects. The class 'Folder' used in the following sections should be associated to a class-descriptor defined in the mapping descriptor.
+ </p>
+ <p>
+ This page describes only the main Persistence Manager methods. You can see the javadoc to get more information on the API.
+ </p>
+
+
+ <subsection name="Insert">
+ <p>
<source>
Folder folder = new Folder();
folder.setPath("/myfolder");
folder.set...(); // call the setter methods
persistenceManager.insert(myFolder);
-
+
</source>
-
- </p>
-
- </subsection>
- <subsection name="Retrieve and update an object">
- <p>
+
+ </p>
+
+ </subsection>
+ <subsection name="Retrieve and update an object">
+ <p>
<source>
Folder folder = (Folder) persistenceManager.getObject(Folder.class, "/myfolder");
folder.set...(); // call the setter methods
persistenceManager.update(myFolder);
-
-</source>
- </p>
-
- </subsection>
-
- <subsection name="Delete">
- <p>
-<source>
+</source>
+
+ </p>
+
+ </subsection>
+
+ <subsection name="Delete">
+ <p>
+<source>
persistenceManager.remove("/test");
</source>
- </p>
-
- </subsection>
-
- <subsection name ="Save last changes">
- <p>After some inserts, deletes and/or updates, you can call the method <code>persistenceManager.save()</code> to apply your changes into the JCR repository.</p>
- </subsection>
-
-
-
-
- </section>
- </body>
-</document>
\ No newline at end of file
+ </p>
+
+ </subsection>
+
+ <subsection name ="Save last changes">
+ <p>After some inserts, deletes and/or updates, you can call the method <code>persistenceManager.save()</code> to apply your changes into the JCR repository.</p>
+ </subsection>
+
+
+
+
+ </section>
+ </body>
+</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/locking.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/locking.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/locking.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/locking.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,26 +16,26 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">
- Christophe Lombart
- </author>
- <title>The Persistence Manager API</title>
- </properties>
- <body>
-
- <section name="Managing Locks">
- <subsection name="Overview">
- <p>
- Following the Jcr specification, it is possible to lock nodes and their children (see section 8.4).
- You can see on this page the OCM API used to lock on the object level.
- In order to lock an object, its matching node has to implement the jcr mixin type "mix:lockable".
- It is possible to specify this node type in the class descriptor :
- </p>
- <p align="center"> <img src="../images/lockable-def.jpg" ></img></p>
- </subsection>
- <subsection name="A basic example">
- <source>
+ <properties>
+ <author email="christophe.lombart@gmail.com">
+ Christophe Lombart
+ </author>
+ <title>The Persistence Manager API</title>
+ </properties>
+ <body>
+
+ <section name="Managing Locks">
+ <subsection name="Overview">
+ <p>
+ Following the Jcr specification, it is possible to lock nodes and their children (see section 8.4).
+ You can see on this page the OCM API used to lock on the object level.
+ In order to lock an object, its matching node has to implement the jcr mixin type "mix:lockable".
+ It is possible to specify this node type in the class descriptor :
+ </p>
+ <p align="center"> <img src="../images/lockable-def.jpg" ></img></p>
+ </subsection>
+ <subsection name="A basic example">
+ <source>
// --------------------------------------------------------------------------------
// Create and store an object graph in the repository
// --------------------------------------------------------------------------------
@@ -47,28 +47,28 @@
b.setB1("b1");
b.setB2("b2");
a.setB(b);
-
+
C c1 = new C();
c1.setId("first");
c1.setName("First Element");
C c2 = new C();
c2.setId("second");
c2.setName("Second Element");
-
+
C c3 = new C();
c3.setId("third");
c3.setName("Third Element");
-
+
Collection collection = new ArrayList();
collection.add(c1);
collection.add(c2);
collection.add(c3);
-
+
a.setCollection(collection);
-
+
persistenceManager.insert(a);
persistenceManager.save();
-
+
// --------------------------------------------------------------------------------
// Check if the object is not locked
@@ -77,27 +77,27 @@
{
System.out.println("Error : The object is locked- humm ??");
}
-
+
// --------------------------------------------------------------------------------
// Lock the object
-// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
String lockToken = persistenceManager.lock("/test", true, false);
-
+
// --------------------------------------------------------------------------------
// Check if the object is not locked
// --------------------------------------------------------------------------------
if (! persistenceManager.isLocked("/test"))
{
System.out.println("Error : The object is not locked- humm ??");
-}
-
+}
+
// --------------------------------------------------------------------------------
// Unlock the object
-// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
persistenceManager.unlock("/test", lockToken);
- </source>
- </subsection>
-
- </section>
- </body>
-</document>
\ No newline at end of file
+ </source>
+ </subsection>
+
+ </section>
+ </body>
+</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/search.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/search.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/search.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/search.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,76 +16,76 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>The Persistence Manager API</title>
- </properties>
- <body>
-
- <section name="Searching objects">
-
- <subsection name="Searching a single object">
- <p>
-
- <source>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>The Persistence Manager API</title>
+ </properties>
+ <body>
+
+ <section name="Searching objects">
+
+ <subsection name="Searching a single object">
+ <p>
+
+ <source>
QueryManager queryManager = persistenceManager.getQueryManager();
-// Build the search filter
+// Build the search filter
Filter filter = queryManager.createFilter(Paragraph.class);
-filter.addEqualTo("text", "Para 1"); // Text is an attribute in the class Paragraph
-
-// Build the query
+filter.addEqualTo("text", "Para 1"); // Text is an attribute in the class Paragraph
+
+// Build the query
Query query = queryManager.createQuery(filter);
-Paragraph paragraph = (Paragraph) persistenceManager.getObject(query);
- </source>
- </p>
-
- </subsection>
-
- <subsection name="Searching a collection">
- <p>
-
- <source>
+Paragraph paragraph = (Paragraph) persistenceManager.getObject(query);
+ </source>
+ </p>
+
+ </subsection>
+
+ <subsection name="Searching a collection">
+ <p>
+
+ <source>
QueryManager queryManager = persistenceManager.getQueryManager();
-Filter filter = queryManager.createFilter(Paragraph.class);
+Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
-Query query = queryManager.createQuery(filter);
+Query query = queryManager.createQuery(filter);
persistenceManager = this.getPersistenceManager();
-Collection result = persistenceManager.getObjects(query);
- </source>
- </p>
-
- </subsection>
- <subsection name="Searching with an iterator">
- <p>
-
- <source>
+Collection result = persistenceManager.getObjects(query);
+ </source>
+ </p>
+
+ </subsection>
+ <subsection name="Searching with an iterator">
+ <p>
+
+ <source>
QueryManager queryManager = persistenceManager.getQueryManager();
-Filter filter = queryManager.createFilter(Paragraph.class);
+Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
-Query query = queryManager.createQuery(filter);
+Query query = queryManager.createQuery(filter);
persistenceManager = this.getPersistenceManager();
-Iterator ierator = persistenceManager.getObjectIterator(query);
- </source>
- </p>
-
- </subsection>
- <subsection name="Remove objects based on a query">
- <p>
-
- <source>
+Iterator ierator = persistenceManager.getObjectIterator(query);
+ </source>
+ </p>
+
+ </subsection>
+ <subsection name="Remove objects based on a query">
+ <p>
+
+ <source>
QueryManager queryManager = persistenceManager.getQueryManager();
-Filter filter = queryManager.createFilter(Paragraph.class);
+Filter filter = queryManager.createFilter(Paragraph.class);
filter.setScope("/test/node1//");
-Query query = queryManager.createQuery(filter);
+Query query = queryManager.createQuery(filter);
persistenceManager = this.getPersistenceManager();
-persistenceManager.remove(query);
- </source>
- </p>
-
- </subsection>
-
-
- </section>
- </body>
+persistenceManager.remove(query);
+ </source>
+ </p>
+
+ </subsection>
+
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/versionning.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/versionning.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/versionning.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/api/versionning.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,39 +16,39 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">
- Christophe Lombart
- </author>
- <title>The Persistence Manager API</title>
- </properties>
- <body>
-
- <section name="Managing versions">
- <subsection name="Overview">
- <p>
- Right now, the OCM tools provides basic versionning features :
- <ul>
- <li>Check in, check out.</li>
- <li>Retrieve version history (first version, last version, the complete history, ...).</li>
- <li>Apply labels.</li>
- </ul>
- </p>
- <p>
- Later, we would like to add more advanced versionning support like version compare, replace, revert, ...
- </p>
- <p>
- Each versionned object has to be mapped to a mix:versionable JCR node.
- It is possible to specify this node type in the class descriptor :
- </p>
- <p align="center"> <img src="../images/versionable-def.jpg" ></img></p>
- </subsection>
- <subsection name="Check in - Check out">
- <source>
-// Create a new page - first version
-Page page = new Page();
-page.setPath("/page");
-page.setTitle("Page Title");
+ <properties>
+ <author email="christophe.lombart@gmail.com">
+ Christophe Lombart
+ </author>
+ <title>The Persistence Manager API</title>
+ </properties>
+ <body>
+
+ <section name="Managing versions">
+ <subsection name="Overview">
+ <p>
+ Right now, the OCM tools provides basic versionning features :
+ <ul>
+ <li>Check in, check out.</li>
+ <li>Retrieve version history (first version, last version, the complete history, ...).</li>
+ <li>Apply labels.</li>
+ </ul>
+ </p>
+ <p>
+ Later, we would like to add more advanced versionning support like version compare, replace, revert, ...
+ </p>
+ <p>
+ Each versionned object has to be mapped to a mix:versionable JCR node.
+ It is possible to specify this node type in the class descriptor :
+ </p>
+ <p align="center"> <img src="../images/versionable-def.jpg" ></img></p>
+ </subsection>
+ <subsection name="Check in - Check out">
+ <source>
+// Create a new page - first version
+Page page = new Page();
+page.setPath("/page");
+page.setTitle("Page Title");
page.addParagraph(new Paragraph("para1"));
page.addParagraph(new Paragraph("para2"));
persistenceManager.insert(page);
@@ -67,20 +67,20 @@
persistenceManager.update(page);
persistenceManager.save();
persistenceManager.checkin("/page");
- </source>
- </subsection>
- <subsection name="Retrieve the version history">
+ </source>
+ </subsection>
+ <subsection name="Retrieve the version history">
<source>
VersionIterator versionIterator = persistenceManager.getAllVersions("/page");
while (versionIterator.hasNext())
{
Version version = (Version) versionIterator.next();
- System.out.println("version found : "+ version.getName() + " - " +
+ System.out.println("version found : "+ version.getName() + " - " +
version.getPath() + " - " + version.getCreated().getTime());
}
-</source>
- </subsection>
- <subsection name="Retrieve version description">
+</source>
+ </subsection>
+ <subsection name="Retrieve version description">
<source>
// Retrieve the first version description
Version baseVersion = persistenceManager.getBaseVersion("/page");
@@ -89,24 +89,24 @@
// Retrieve the latest version description
Version rootVersion = persistenceManager.getRootVersion("/page");
System.out.println("Root version : " + rootVersion.getName());
-</source>
- </subsection>
- <subsection name="Retrieve the object state matching to a specific version">
+</source>
+ </subsection>
+ <subsection name="Retrieve the object state matching to a specific version">
<source>
-//Get the object matching to the first version
+//Get the object matching to the first version
Page page = (Page) persistenceManager.getObject( "/page", "1.0");
-</source>
- </subsection>
- <subsection name="Using version labels">
+</source>
+ </subsection>
+ <subsection name="Using version labels">
<source>
Page page = new Page();
page.setPath("/page");
-page.setTitle("Page Title");
+page.setTitle("Page Title");
page.addParagraph(new Paragraph("para1"));
page.addParagraph(new Paragraph("para2"));
persistenceManager.insert(page);
persistenceManager.save();
-
+
// Checkin with some labels
page.addParagraph(new Paragraph("para3"));
persistenceManager.checkout("/page");
@@ -114,12 +114,12 @@
persistenceManager.save();
persistenceManager.checkin("/page", new String[] {"A", "B"});
-// Checkin with some labels
+// Checkin with some labels
page.addParagraph(new Paragraph("para4"));
persistenceManager.checkout("/page");
persistenceManager.update(page);
persistenceManager.save();
-persistenceManager.checkin("/page", new String[] {"C", "D"});
+persistenceManager.checkin("/page", new String[] {"C", "D"});
// Retrieve all labels
String[] allLabels = persistenceManager.getAllVersionLabels("/page");
@@ -131,9 +131,9 @@
assertTrue("Incorrect label", versionLabels[0].equals("C") || versionLabels[0].equals("D"));
assertTrue("Incorrect label", versionLabels[1].equals("C") || versionLabels[0].equals("D"));
-</source>
- </subsection>
-
- </section>
- </body>
+</source>
+ </subsection>
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-configuration.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-configuration.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-configuration.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-configuration.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,14 +16,14 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Graffito JCR Persistence Manager</title>
- </properties>
- <body>
- <section name="The Persistence Manager Configuration">
-
- <p>TODO</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Graffito JCR Persistence Manager</title>
+ </properties>
+ <body>
+ <section name="The Persistence Manager Configuration">
+
+ <p>TODO</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-introduction.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-introduction.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-introduction.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-introduction.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,61 +16,61 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Graffito JCR Persistence Manager</title>
- </properties>
- <body>
- <section name="The Persistence Manager">
- <p>
- The main component in this OCM framework is the Persistence Manager.
- It converts an object graph into JCR nodes and properties and vice versa.
- The persistence manager is associated to a JCR Session.
- Depending on your needs, you can use one or more persistence managers in your application.
- Usually, there is one persistence manager per user session.
-
- </p>
- <p>
- See the page <a href="engine-setup.html">Sectup</a> and <a href="engine-spring.html">Spring integration</a> to get more information on how to initialize correctly the Persistence Manager in your java application.
- </p>
-
- <subsection name="How the Persistence Manager is working ?">
-
- <p>
- Thanks to its Mapping Descriptor file, the Persistence Manager is able to use the more appropriate mapping strategy for each object.
- This Mapping Descriptor file contains one class descriptor per persistent class.
- Each class descriptor contains mapping information for the corresponding class attributes.
-
- </p>
- <p>
- In all cases, the desired persistent class is mapped to a JCR node and its fields are mapped to subnodes or properties depending on their type (see below).
- </p>
-
- <p>
- There are 4 "field types" :
- <ol>
- <li>Atomic fields : primitive data types and simple objects (String, Long, Double, ...) . Those fields are mapped into JCR properties. </li>
- <li>Bean fields : One class can contain an 1..1 association to another bean. In this case, the attribute is a custom object. Those fields are mapped into JCR subnodes. </li>
- <li>Collection fields : One class can contain an 1..n association to a collection of beans (or Map). Those fields are mapped into a collection of JCR subnodes. </li>
- <li>Reference field : One good example to understand the "reference" type is the Folder concept.
- A folder "B" can have an attribute called "parentFolder" which is a simple field pointing to the parent folder "A" .
- Of course, in a JCR repository, it is a nonsense for persist this "parentFolder" attribute into a "B" subnode.
- Another interesting example are references between cms objects (folders, documents, ...). This type is not yet implemented.</li>
- </ol>
- Of course, all those "field types" imply different mapping algorithms.
- </p>
- <p>
- The descriptor file contains also information on inheritance/interface mapping strategy, lazy loading, custom converter, cache strategy, ...
- </p>
- </subsection>
- <subsection name="The Mapping Descriptor File">
- <p>The mapping descriptor is an xml file with the following structure : </p>
- <p>
- <p align="center"> <img src="./images/xml-file-descriptor.jpg" ></img></p>
- </p>
- <p>The root element is "graffito-jcr" and it contains one or more "class-descriptor". As you can see in the sections "Mapping Strategies" and "Advanced Mapping Strategies", each class-descriptor contains the mapping information used for each class attributes.</p>
- <p>It is possible to have severals xml files. See the <a href="engine-setup.html">Sectup section</a> to get more information on how to initialize the Persistence Manager. </p>
- </subsection>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Graffito JCR Persistence Manager</title>
+ </properties>
+ <body>
+ <section name="The Persistence Manager">
+ <p>
+ The main component in this OCM framework is the Persistence Manager.
+ It converts an object graph into JCR nodes and properties and vice versa.
+ The persistence manager is associated to a JCR Session.
+ Depending on your needs, you can use one or more persistence managers in your application.
+ Usually, there is one persistence manager per user session.
+
+ </p>
+ <p>
+ See the page <a href="engine-setup.html">Sectup</a> and <a href="engine-spring.html">Spring integration</a> to get more information on how to initialize correctly the Persistence Manager in your java application.
+ </p>
+
+ <subsection name="How the Persistence Manager is working ?">
+
+ <p>
+ Thanks to its Mapping Descriptor file, the Persistence Manager is able to use the more appropriate mapping strategy for each object.
+ This Mapping Descriptor file contains one class descriptor per persistent class.
+ Each class descriptor contains mapping information for the corresponding class attributes.
+
+ </p>
+ <p>
+ In all cases, the desired persistent class is mapped to a JCR node and its fields are mapped to subnodes or properties depending on their type (see below).
+ </p>
+
+ <p>
+ There are 4 "field types" :
+ <ol>
+ <li>Atomic fields : primitive data types and simple objects (String, Long, Double, ...) . Those fields are mapped into JCR properties. </li>
+ <li>Bean fields : One class can contain an 1..1 association to another bean. In this case, the attribute is a custom object. Those fields are mapped into JCR subnodes. </li>
+ <li>Collection fields : One class can contain an 1..n association to a collection of beans (or Map). Those fields are mapped into a collection of JCR subnodes. </li>
+ <li>Reference field : One good example to understand the "reference" type is the Folder concept.
+ A folder "B" can have an attribute called "parentFolder" which is a simple field pointing to the parent folder "A" .
+ Of course, in a JCR repository, it is a nonsense for persist this "parentFolder" attribute into a "B" subnode.
+ Another interesting example are references between cms objects (folders, documents, ...). This type is not yet implemented.</li>
+ </ol>
+ Of course, all those "field types" imply different mapping algorithms.
+ </p>
+ <p>
+ The descriptor file contains also information on inheritance/interface mapping strategy, lazy loading, custom converter, cache strategy, ...
+ </p>
+ </subsection>
+ <subsection name="The Mapping Descriptor File">
+ <p>The mapping descriptor is an xml file with the following structure : </p>
+ <p>
+ <p align="center"> <img src="./images/xml-file-descriptor.jpg" ></img></p>
+ </p>
+ <p>The root element is "graffito-jcr" and it contains one or more "class-descriptor". As you can see in the sections "Mapping Strategies" and "Advanced Mapping Strategies", each class-descriptor contains the mapping information used for each class attributes.</p>
+ <p>It is possible to have severals xml files. See the <a href="engine-setup.html">Sectup section</a> to get more information on how to initialize the Persistence Manager. </p>
+ </subsection>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-setup.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-setup.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-setup.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-setup.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,69 +16,69 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Graffito JCR Persistence Manager</title>
- </properties>
- <body>
- <section name="The Persistence Manager Setup">
-
- <subsection name = "Basic setup">
- <p>When you start your application, you need the following code to initialize correctly the Persistence Manager.</p>
- <source>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Graffito JCR Persistence Manager</title>
+ </properties>
+ <body>
+ <section name="The Persistence Manager Setup">
+
+ <subsection name = "Basic setup">
+ <p>When you start your application, you need the following code to initialize correctly the Persistence Manager.</p>
+ <source>
import javax.jcr.Session;
import javax.jcr.Repository;
-
+
import org.apache.portals.graffito.jcr.mapper.Mapper;
-import org.apache.portals.graffito.jcr.mapper.impl.DigesterMapperImpl;
-
+import org.apache.portals.graffito.jcr.mapper.impl.DigesterMapperImpl;
+
import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverterProvider;
import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.DefaultAtomicTypeConverterProvider;
-
+
import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
import org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ObjectConverterImpl;
import org.apache.portals.graffito.jcr.query.QueryManager;
import org.apache.portals.graffito.jcr.query.impl.QueryManagerImpl;
import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
-
+
// 1. Instantiate a JCR session
-
+
Repository repository = RepositoryUtil.getRepository("repositoryTest");
Session session = RepositoryUtil.login(repository, "superuser", "superuser");
-
+
// 2. Specify the different mapping files
-
-String[] files = { "./src/test-config/jcrmapping.xml",
- "./src/test-config/jcrmapping-atomic.xml",
- "./src/test-config/jcrmapping-beandescriptor.xml"};
+
+String[] files = { "./src/test-config/jcrmapping.xml",
+ "./src/test-config/jcrmapping-atomic.xml",
+ "./src/test-config/jcrmapping-beandescriptor.xml"};
// 3. Initialise the PersistenceManager dependencies
-
+
Mapper mapper = new DigesterMapperImpl(files).buildMapper();
AtomicTypeConverterProvider converterProvider = new DefaultAtomicTypeConverterProvider();
Map atomicTypeConverters = converterProvider.getAtomicTypeConverters();
QueryManager queryManager = new QueryManagerImpl(mapper, atomicTypeConverters);
ObjectConverter objectConverter = new ObjectConverterImpl(mapper, converterProvider);
-
+
// 4. Intantiate the PersistenceManager
-
-PersistenceManager persistenceManager = new PersistenceManagerImpl(mapper, objectConverter, queryManager, session);
-
-
-</source>
- <p>See the page <a href="api/api-intro.html">here</a> to get a complete overview on the Persistence Manager API.</p>
- </subsection>
-
- <subsection name="Platform/Framework integration">
- <p>You can also get more information on the Spring support <a href="engine-spring.html">here</a>.</p>
- <p>Of course, support for other containers are welcome.</p>
- </subsection>
-
- </section>
-
-
-
-
- </body>
+
+PersistenceManager persistenceManager = new PersistenceManagerImpl(mapper, objectConverter, queryManager, session);
+
+
+</source>
+ <p>See the page <a href="api/api-intro.html">here</a> to get a complete overview on the Persistence Manager API.</p>
+ </subsection>
+
+ <subsection name="Platform/Framework integration">
+ <p>You can also get more information on the Spring support <a href="engine-spring.html">here</a>.</p>
+ <p>Of course, support for other containers are welcome.</p>
+ </subsection>
+
+ </section>
+
+
+
+
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-spring.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-spring.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-spring.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/engine-spring.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,13 +16,13 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Graffito JCR Persistence Manager</title>
- </properties>
- <body>
- <section name="Spring Integration ">
- <p>We are currently working on the Spring integration. You can follow our work in the folder <code>[graffito-trunk-folder]/jcr/spring</code>.</p>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Graffito JCR Persistence Manager</title>
+ </properties>
+ <body>
+ <section name="Spring Integration ">
+ <p>We are currently working on the Spring integration. You can follow our work in the folder <code>[graffito-trunk-folder]/jcr/spring</code>.</p>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/index.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/index.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/index.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/index.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -14,41 +14,41 @@
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.
-
+
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Graffito JCR Mapping</title>
- </properties>
- <body>
- <section name="Overview">
- <subsection name="Object/Content Mapping framework (ocm)">
- <p>This Graffito subproject is an object/JCR persistence and query service. This tools lets you to persist java objects into a JCR compliant repository - including association, inheritance, polymorphism, composition, and the Java collections framework. Furthermore, this jcr-mapping allows you to express queries in Java-based Criteria, as well as in JCR query language. It offers also features like version support and object locking.</p>
-
- <p>In order to easily support the JCR specification, any content application managing an high level object model can use this framework. For example, a classic Forum application contains objects like "Forum", "Topic" and "Post". Now, the data objects (pojo) can be managed by our JCR mapping tools in order to persist them into a JCR compliant repository.</p>
-
-
- </subsection>
- <subsection name ="Why an ocm ?">
-
- <p>A couple of month ago, we have decided to create a new object mapping framework for different reasons : </p>
- <ul>
- <li>Sometimes it is very convenient to be able to just access the JCR nodes and properties directly from your presentation-layer for very simple things (mostly generic display). When a lot of "business logic" are involved, the JCR API can be too low level and real business objects (pojo) are more appreciate in a such case.</li>
- <li>The OCM framework provides more abstraction on the technologies used to persist your content. The different application layers are less dependent on the JCR API.</li>
- <li>ORM tools like OJB or Hibernate are not appropriate for content oriented application.</li>
- </ul>
-
- </subsection>
- <subsection name ="Prerequisite">
- <p>
- Before using this OCM framework, you should review the JCR specification and implementations like <a href="http://incubator.apache.org/jackrabbit/">JackRabbit</a>.
- </p>
-
- </subsection>
- <subsection name="Download">
- <p>There are no releases yet. See the menu "Getting Started" for instructions on how to download and build the Graffito JCR mapping sources.</p>
- </subsection>
- </section>
- </body>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Graffito JCR Mapping</title>
+ </properties>
+ <body>
+ <section name="Overview">
+ <subsection name="Object/Content Mapping framework (ocm)">
+ <p>This Graffito subproject is an object/JCR persistence and query service. This tools lets you to persist java objects into a JCR compliant repository - including association, inheritance, polymorphism, composition, and the Java collections framework. Furthermore, this jcr-mapping allows you to express queries in Java-based Criteria, as well as in JCR query language. It offers also features like version support and object locking.</p>
+
+ <p>In order to easily support the JCR specification, any content application managing an high level object model can use this framework. For example, a classic Forum application contains objects like "Forum", "Topic" and "Post". Now, the data objects (pojo) can be managed by our JCR mapping tools in order to persist them into a JCR compliant repository.</p>
+
+
+ </subsection>
+ <subsection name ="Why an ocm ?">
+
+ <p>A couple of month ago, we have decided to create a new object mapping framework for different reasons : </p>
+ <ul>
+ <li>Sometimes it is very convenient to be able to just access the JCR nodes and properties directly from your presentation-layer for very simple things (mostly generic display). When a lot of "business logic" are involved, the JCR API can be too low level and real business objects (pojo) are more appreciate in a such case.</li>
+ <li>The OCM framework provides more abstraction on the technologies used to persist your content. The different application layers are less dependent on the JCR API.</li>
+ <li>ORM tools like OJB or Hibernate are not appropriate for content oriented application.</li>
+ </ul>
+
+ </subsection>
+ <subsection name ="Prerequisite">
+ <p>
+ Before using this OCM framework, you should review the JCR specification and implementations like <a href="http://incubator.apache.org/jackrabbit/">JackRabbit</a>.
+ </p>
+
+ </subsection>
+ <subsection name="Download">
+ <p>There are no releases yet. See the menu "Getting Started" for instructions on how to download and build the Graffito JCR mapping sources.</p>
+ </subsection>
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/introduction-strategies.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/introduction-strategies.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/introduction-strategies.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/introduction-strategies.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,165 +16,165 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Introduction to the Mapping Strategies</title>
- </properties>
- <body>
- <section name="Introduction to the Mapping Strategies">
-
- <p>
- We are calling "Mapping strategy" the algorithm used by the Persistence Manager to map a bean into JCR nodes and/or properties.
-
- </p>
-
- <p>
- In order to explain the basic mapping strategies, we will use the following simple object model :
- <ul>
- <li>A page contains a path (of course), a pageInfo and a collection of paragraphs.</li>
- <li>The PageInfo class contains the title and the page description. We are using the pageInfo here to see all mapping features (see the bean-descriptors). In real application, this class is not necessary :-)</li>
- <li>Each paragraph contains a path and a text field.</li>
- </ul>
- <p align="center"> <img src="./images/sample-model-doc.png" ></img></p>
- </p>
- <p>
- This object model could be too simple for real applications and it is used here just to simplify the description of the different mapping strategies.
- </p>
- <p>Based on that object model, we can define the following java classes :</p>
-
- <source>
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Introduction to the Mapping Strategies</title>
+ </properties>
+ <body>
+ <section name="Introduction to the Mapping Strategies">
+
+ <p>
+ We are calling "Mapping strategy" the algorithm used by the Persistence Manager to map a bean into JCR nodes and/or properties.
+
+ </p>
+
+ <p>
+ In order to explain the basic mapping strategies, we will use the following simple object model :
+ <ul>
+ <li>A page contains a path (of course), a pageInfo and a collection of paragraphs.</li>
+ <li>The PageInfo class contains the title and the page description. We are using the pageInfo here to see all mapping features (see the bean-descriptors). In real application, this class is not necessary :-)</li>
+ <li>Each paragraph contains a path and a text field.</li>
+ </ul>
+ <p align="center"> <img src="./images/sample-model-doc.png" ></img></p>
+ </p>
+ <p>
+ This object model could be too simple for real applications and it is used here just to simplify the description of the different mapping strategies.
+ </p>
+ <p>Based on that object model, we can define the following java classes :</p>
+
+ <source>
public class Page
{
- String path;
- PageInfo pageInfo;
- Collection paragraphs;
-
- /* Add here the getter and setter methods */
-
- public void addParagraph(Paragraph paragraph)
- {
- if (paragraphs == null)
- {
- paragraphs = new ArrayList();
- }
-
- paragraphs.add(paragraph);
- }
-}
+ String path;
+ PageInfo pageInfo;
+ Collection paragraphs;
+
+ /* Add here the getter and setter methods */
+
+ public void addParagraph(Paragraph paragraph)
+ {
+ if (paragraphs == null)
+ {
+ paragraphs = new ArrayList();
+ }
+
+ paragraphs.add(paragraph);
+ }
+}
public class PageInfo
{
- String path;
- String title;
- String description;
+ String path;
+ String title;
+ String description;
- /* Add here the getter and setter methods */
+ /* Add here the getter and setter methods */
}
public class Paragraph
{
- private String path;
- private String text;
-
- /* Add here the getter and setter methods */
-
+ private String path;
+ private String text;
+
+ /* Add here the getter and setter methods */
+
}
- </source>
-
-
- <subsection name="The Class descriptor">
- <p>When you decide to map a bean class, you have to create a new class descriptor entry in the Persistence Manager descriptor file.</p>
- <p>Here are the class-descriptors required to map the classes Page, PageInfo and Paragraph :</p>
- <source><![CDATA[
+ </source>
+
+
+ <subsection name="The Class descriptor">
+ <p>When you decide to map a bean class, you have to create a new class descriptor entry in the Persistence Manager descriptor file.</p>
+ <p>Here are the class-descriptors required to map the classes Page, PageInfo and Paragraph :</p>
+ <source><![CDATA[
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrType="graffito:page">
- <field-descriptor fieldName="path" path="true" />
- <bean-descriptor fieldName="pageInfo" jcrName="pageInfo" />
- <collection-descriptor fieldName="paragraphs" jcrName="paragraphs" elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph" />
+ <field-descriptor fieldName="path" path="true" />
+ <bean-descriptor fieldName="pageInfo" jcrName="pageInfo" />
+ <collection-descriptor fieldName="paragraphs" jcrName="paragraphs" elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph" />
</class-descriptor>
-
+
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.PageInfo" jcrType="graffito:PageInfo">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="title" jcrName="graffito:title"/>
- <field-descriptor fieldName="description" jcrName="graffito:description"/>
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="title" jcrName="graffito:title"/>
+ <field-descriptor fieldName="description" jcrName="graffito:description"/>
</class-descriptor>
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrType="graffito:paragraph">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="text" jcrName="graffito:text"/>
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="graffito:text"/>
</class-descriptor>
- ]]></source>
-
- <p>
- We will explain in more details each descriptors in the following sections (<a href="atomic-strategy.html">Mapping Atomic Fields</a>,<a href="bean-strategy.html">Mapping Bean Fields</a> and <a href="collection-strategy.html">Mapping Collection Fields</a>. If the page is stored on the path "/mysite/mypage1" and contains 2 paragraphs, here is the resulting jcr structure :
- </p>
- <p>
- <source><![CDATA[
-/mysite/page1
- /mysite/page1/pageInfo
- graffito:title = "This is my page title"
- graffito:description = "This is my page description"
- /mysite/page1/paragraphs
- /mysite/page1/paragraphs/paragraph1
- graffito:text = "This is the content of para1"
- /mysite/page1/paragraphs/paragraph2
- graffito:text = ""This is the content of para2"
- ]]></source>
- </p>
- <p>It is possible to have another kind of jcr structure by using other mapping strategies. You can see the section "Advance Mapping strategies" to get more information on that.</p>
-
-
+ ]]></source>
+
+ <p>
+ We will explain in more details each descriptors in the following sections (<a href="atomic-strategy.html">Mapping Atomic Fields</a>,<a href="bean-strategy.html">Mapping Bean Fields</a> and <a href="collection-strategy.html">Mapping Collection Fields</a>. If the page is stored on the path "/mysite/mypage1" and contains 2 paragraphs, here is the resulting jcr structure :
+ </p>
+ <p>
+ <source><![CDATA[
+/mysite/page1
+ /mysite/page1/pageInfo
+ graffito:title = "This is my page title"
+ graffito:description = "This is my page description"
+ /mysite/page1/paragraphs
+ /mysite/page1/paragraphs/paragraph1
+ graffito:text = "This is the content of para1"
+ /mysite/page1/paragraphs/paragraph2
+ graffito:text = ""This is the content of para2"
+ ]]></source>
+ </p>
+ <p>It is possible to have another kind of jcr structure by using other mapping strategies. You can see the section "Advance Mapping strategies" to get more information on that.</p>
+
+
- <p>Now, let's go back to the class-descriptor.</p>
- <source><![CDATA[
+ <p>Now, let's go back to the class-descriptor.</p>
+ <source><![CDATA[
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrType="nt:unstructured">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="text" jcrName="graffito:text"/>
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="graffito:text"/>
</class-descriptor>
- ]]></source>
+ ]]></source>
- <p>This class descriptor maps the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" to the JCR type "nt:unstructured". Each field-descriptors maps one bean attribute to a JCR property. You can find more information on the field-descriptors in the page <a href="atomic-strategy.html">Mapping Atomic fields</a>.
- </p>
- <p>
- It is also possible to map a bean class to a specific JCR node type. The following class-descriptor map the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" to the node type "graffito:paragraph".
- </p>
- <source><![CDATA[
+ <p>This class descriptor maps the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" to the JCR type "nt:unstructured". Each field-descriptors maps one bean attribute to a JCR property. You can find more information on the field-descriptors in the page <a href="atomic-strategy.html">Mapping Atomic fields</a>.
+ </p>
+ <p>
+ It is also possible to map a bean class to a specific JCR node type. The following class-descriptor map the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" to the node type "graffito:paragraph".
+ </p>
+ <source><![CDATA[
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrType="graffito:paragraph">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="text" jcrName="graffito:text"/>
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="graffito:text"/>
</class-descriptor>
- ]]></source>
+ ]]></source>
- <p>
- In order to use correclty our example class with <a href="http://incubator.apache.org/jackrabbit/">Jackrabbit</a>, you should add the following node type definition in its custom_nodetypes.xml file or import the node type definition with the Jackrabbit API
- </p>
-
- <source><![CDATA[
+ <p>
+ In order to use correclty our example class with <a href="http://incubator.apache.org/jackrabbit/">Jackrabbit</a>, you should add the following node type definition in its custom_nodetypes.xml file or import the node type definition with the Jackrabbit API
+ </p>
+
+ <source><![CDATA[
<nodeType name="graffito:paragraph" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>mix:versionable</supertype>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinition name="*" requiredType="undefined" autoCreated="false"
- mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
- <propertyDefinition name="graffito:text" requiredType="String" autoCreated="false"
- mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
+ <supertypes>
+ <supertype>mix:versionable</supertype>
+ <supertype>nt:base</supertype>
+ </supertypes>
+ <propertyDefinition name="*" requiredType="undefined" autoCreated="false"
+ mandatory="false" onParentVersion="COPY" protected="false" multiple="false" />
+ <propertyDefinition name="graffito:text" requiredType="String" autoCreated="false"
+ mandatory="true" onParentVersion="COPY" protected="false" multiple="false" />
</nodeType>
- ]]></source>
- <p>
- Of course, node types "Graffito:Page" and "Graffito:PageInfo" are alse required. We are currently building a node type management tools which can import the node types from the class-descriptors.</p>
- </subsection>
- <subsection name ="The path Field">
- <p>
- Each mapped class contains a mandatory field called the "path field". It simply contains the JCR path associated to the object.
- For example, the following descriptor specify the bean field "myPath" as the path field.
- </p>
- <source><![CDATA[
+ ]]></source>
+ <p>
+ Of course, node types "Graffito:Page" and "Graffito:PageInfo" are alse required. We are currently building a node type management tools which can import the node types from the class-descriptors.</p>
+ </subsection>
+ <subsection name ="The path Field">
+ <p>
+ Each mapped class contains a mandatory field called the "path field". It simply contains the JCR path associated to the object.
+ For example, the following descriptor specify the bean field "myPath" as the path field.
+ </p>
+ <source><![CDATA[
<field-descriptor fieldName="myPath" path="true" />
- ]]></source>
-
- </subsection>
-
- </section>
- </body>
+ ]]></source>
+
+ </subsection>
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/navigation.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/navigation.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/navigation.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/navigation.xml Tue Jan 1 16:37:21 2008
@@ -16,54 +16,54 @@
limitations under the License.
-->
<!--
- WARNING: This file is generated. The source is xdocs-templates/navigation.xml
+ WARNING: This file is generated. The source is xdocs-templates/navigation.xml
Note: Changes to this file are not reflected on the generated site until the
- allSite goal is atained, i.e. maven allSite
+ allSite goal is atained, i.e. maven allSite
-->
<project>
- <body>
- <links>
- <item name="Graffito Home" href="../index.html"/>
- </links>
+ <body>
+ <links>
+ <item name="Graffito Home" href="../index.html"/>
+ </links>
<menu name="General Information">
- <item name="Overview" href="index.html"/>
-
- </menu>
- <!-- menu name="Getting Started">
- </menu -->
-
- <menu name="Persistence Manager">
- <item name="Overview" href="engine-introduction.html"/>
- <item name="Mapping Descriptor DTD" href="jackrabbit-ocm.dtd.txt"/>
- <item name="Setup" href="engine-setup.html"/>
- <item name="Spring Integration" href="engine-spring.html"/>
- </menu>
-
- <menu name="Persistence Manager API">
- <item name="Overview" href = "api/api-intro.html" collapse="true" />
- <item name="Basic operations" href="api/basic-operations.html" collapse="true"/>
- <item name="Search" href="api/search.html" collapse="true"/>
- <item name="Managing Versions" href="api/versionning.html" collapse="true"/>
- <item name="Locking" href="api/locking.html" collapse="true"/>
- </menu>
-
- <menu name="Basic Mapping Stategies">
- <item name="Introduction" href="simple-strategies/introduction-strategies.html"/>
- <item name="Mapping Atomic Fields" href="simple-strategies/atomic-strategy.html"/>
- <item name="Mapping Bean Fields" href="simple-strategies/bean-strategy.html"/>
- <item name="Mapping Collection Fields" href="simple-strategies/collection-strategy.html"/>
-
- </menu>
-
- <menu name="Advanced Mapping Stategies">
- <item name="Inheritance and Interface" href="advanced-strategies/inheritance-interface-strategies.html"/>
- <item name="Performance" href="advanced-strategies/inheritance-interface-strategies.html"/>
-
-
-
- </menu>
-
-
- </body>
-</project>
\ No newline at end of file
+ <item name="Overview" href="index.html"/>
+
+ </menu>
+ <!-- menu name="Getting Started">
+ </menu -->
+
+ <menu name="Persistence Manager">
+ <item name="Overview" href="engine-introduction.html"/>
+ <item name="Mapping Descriptor DTD" href="jackrabbit-ocm.dtd.txt"/>
+ <item name="Setup" href="engine-setup.html"/>
+ <item name="Spring Integration" href="engine-spring.html"/>
+ </menu>
+
+ <menu name="Persistence Manager API">
+ <item name="Overview" href = "api/api-intro.html" collapse="true" />
+ <item name="Basic operations" href="api/basic-operations.html" collapse="true"/>
+ <item name="Search" href="api/search.html" collapse="true"/>
+ <item name="Managing Versions" href="api/versionning.html" collapse="true"/>
+ <item name="Locking" href="api/locking.html" collapse="true"/>
+ </menu>
+
+ <menu name="Basic Mapping Stategies">
+ <item name="Introduction" href="simple-strategies/introduction-strategies.html"/>
+ <item name="Mapping Atomic Fields" href="simple-strategies/atomic-strategy.html"/>
+ <item name="Mapping Bean Fields" href="simple-strategies/bean-strategy.html"/>
+ <item name="Mapping Collection Fields" href="simple-strategies/collection-strategy.html"/>
+
+ </menu>
+
+ <menu name="Advanced Mapping Stategies">
+ <item name="Inheritance and Interface" href="advanced-strategies/inheritance-interface-strategies.html"/>
+ <item name="Performance" href="advanced-strategies/inheritance-interface-strategies.html"/>
+
+
+
+ </menu>
+
+
+ </body>
+</project>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/atomic-strategy.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/atomic-strategy.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/atomic-strategy.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/atomic-strategy.xml Tue Jan 1 16:37:21 2008
@@ -1,5 +1,5 @@
<?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.
@@ -16,98 +16,98 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Mapping Atomic Fields</title>
- </properties>
- <body>
-
- <section name="Mapping Atomic Fields">
- <subsection name="Introduction">
- <p>The field-descriptor maps a bean attribute based on a java primitive type into a JCR property.
- By default, the persistence manager uses the correct mapping in function of the attribute type (see below the section "Supported Types").</p>
- <p>Based on our model defined <a href="introduction-strategies.html">here</a>,
- the following field-descriptor maps the bean field "title" (String type) into the JCR property "graffito:title".</p>
- <p align="center"><img src="../images/atomic-fields-def.jpg" ></img></p>
-
- </subsection>
- <subsection name ="Supported Types">
- <p>It is not necessary to specify the type in the field-descriptor.
- The Persistence Manager uses the java introspection to get information on each atomic field.</p>
- <table>
- <tr>
- <th>Java Type</th>
- <th>Jcr Type</th>
- </tr>
- <tr>
- <td>String</td>
- <td>STRING</td>
- </tr>
- <tr>
- <td>Boolean, boolean</td>
- <td>BOOLEAN</td>
- </tr>
- <tr>
- <td>Double, double</td>
- <td>DOUBLE</td>
- </tr>
- <tr>
- <td>Integer, int</td>
- <td>DOUBLE</td>
- </tr>
- <tr>
- <td>Long, long</td>
- <td>LONG</td>
- </tr>
- <tr>
- <td>byte[]</td>
- <td>BINARY</td>
- </tr>
-
- <tr>
- <td>java.io.InputStream</td>
- <td>BINARY</td>
- </tr>
-
- <tr>
- <td>java.util.Calendar</td>
- <td>LONG (corresponding to Calendar.getTimeInMillis()</td>
- </tr>
-
- <tr>
- <td>java.sql.Timestamp</td>
- <td>LONG (corresponding to Timestamp.getTime()</td>
- </tr>
- <tr>
- <td>java.util.Date</td>
- <td>LONG (corresponding to java.util.Date.getTime()</td>
- </tr>
-
- </table>
- <p>
- Due to some issues with Jackrabbit (mainly with xpath queries), Calendar, Timestamp and date are converted into JCR LONG.
- We plan to add other converters for those types in the next release.
- </p>
- </subsection>
- <subsection name ="Using Another Atomic Type Converter">
- <p>
- The OCM framework gives you the freedom to choose another kind of mapping for atomic fields.
- For example, you can convert java.util.Date bean field into a JCR Date type instead of a JCR Long type.
- This can be done by writting your own atomic type converter class.
- </p>
- <p>
- Let's start with a simple example.
- If you want to use a mapping strategy which convert a boolean bean field into a JCR Long type, you have to make the following steps :
- <ol>
- <li>Specify the converter class in the field descriptor :
- <source><![CDATA[
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Mapping Atomic Fields</title>
+ </properties>
+ <body>
+
+ <section name="Mapping Atomic Fields">
+ <subsection name="Introduction">
+ <p>The field-descriptor maps a bean attribute based on a java primitive type into a JCR property.
+ By default, the persistence manager uses the correct mapping in function of the attribute type (see below the section "Supported Types").</p>
+ <p>Based on our model defined <a href="introduction-strategies.html">here</a>,
+ the following field-descriptor maps the bean field "title" (String type) into the JCR property "graffito:title".</p>
+ <p align="center"><img src="../images/atomic-fields-def.jpg" ></img></p>
+
+ </subsection>
+ <subsection name ="Supported Types">
+ <p>It is not necessary to specify the type in the field-descriptor.
+ The Persistence Manager uses the java introspection to get information on each atomic field.</p>
+ <table>
+ <tr>
+ <th>Java Type</th>
+ <th>Jcr Type</th>
+ </tr>
+ <tr>
+ <td>String</td>
+ <td>STRING</td>
+ </tr>
+ <tr>
+ <td>Boolean, boolean</td>
+ <td>BOOLEAN</td>
+ </tr>
+ <tr>
+ <td>Double, double</td>
+ <td>DOUBLE</td>
+ </tr>
+ <tr>
+ <td>Integer, int</td>
+ <td>DOUBLE</td>
+ </tr>
+ <tr>
+ <td>Long, long</td>
+ <td>LONG</td>
+ </tr>
+ <tr>
+ <td>byte[]</td>
+ <td>BINARY</td>
+ </tr>
+
+ <tr>
+ <td>java.io.InputStream</td>
+ <td>BINARY</td>
+ </tr>
+
+ <tr>
+ <td>java.util.Calendar</td>
+ <td>LONG (corresponding to Calendar.getTimeInMillis()</td>
+ </tr>
+
+ <tr>
+ <td>java.sql.Timestamp</td>
+ <td>LONG (corresponding to Timestamp.getTime()</td>
+ </tr>
+ <tr>
+ <td>java.util.Date</td>
+ <td>LONG (corresponding to java.util.Date.getTime()</td>
+ </tr>
+
+ </table>
+ <p>
+ Due to some issues with Jackrabbit (mainly with xpath queries), Calendar, Timestamp and date are converted into JCR LONG.
+ We plan to add other converters for those types in the next release.
+ </p>
+ </subsection>
+ <subsection name ="Using Another Atomic Type Converter">
+ <p>
+ The OCM framework gives you the freedom to choose another kind of mapping for atomic fields.
+ For example, you can convert java.util.Date bean field into a JCR Date type instead of a JCR Long type.
+ This can be done by writting your own atomic type converter class.
+ </p>
+ <p>
+ Let's start with a simple example.
+ If you want to use a mapping strategy which convert a boolean bean field into a JCR Long type, you have to make the following steps :
+ <ol>
+ <li>Specify the converter class in the field descriptor :
+ <source><![CDATA[
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Atomic" jcrType="nt:unstructured" >
- <field-descriptor fieldName="int2boolean" jcrName="int2boolean" converter="org.apache.portals.graffito.jcr.persistence.atomic.Int2BooleanTypeConverterImpl" />
+ <field-descriptor fieldName="int2boolean" jcrName="int2boolean" converter="org.apache.portals.graffito.jcr.persistence.atomic.Int2BooleanTypeConverterImpl" />
</class-descriptor>
- ]]></source>
- </li>
- <li>Implement the converter class (based on the interface org.apache.portals.graffito.jcr.persistence.atomic.AtomicTypeConverter) :
-<source><![CDATA[
+ ]]></source>
+ </li>
+ <li>Implement the converter class (based on the interface org.apache.portals.graffito.jcr.persistence.atomic.AtomicTypeConverter) :
+<source><![CDATA[
package org.apache.portals.graffito.jcr.persistence.atomic;
import javax.jcr.Value;
@@ -120,74 +120,74 @@
* This is a simple converter which convert a boolean field value into a jcr long property.
*
* @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ *
*/
public class Int2BooleanTypeConverterImpl implements AtomicTypeConverter
{
- /**
- *
- * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
- */
- public Value getValue(ValueFactory valueFactory, Object propValue)
- {
- if (propValue == null)
- {
- return null;
- }
- boolean value = ((Boolean) propValue).booleanValue();
- int jcrValue = 0;
-
- if (value)
- {
- jcrValue = 1;
- }
- return valueFactory.createValue(jcrValue);
- }
-
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
+ */
+ public Value getValue(ValueFactory valueFactory, Object propValue)
+ {
+ if (propValue == null)
+ {
+ return null;
+ }
+ boolean value = ((Boolean) propValue).booleanValue();
+ int jcrValue = 0;
+
+ if (value)
+ {
+ jcrValue = 1;
+ }
+ return valueFactory.createValue(jcrValue);
+ }
+
/**
- *
+ *
* @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getObject(javax.jcr.Value)
*/
- public Object getObject(Value value)
+ public Object getObject(Value value)
{
- try
- {
- long jcrValue = value.getLong();
- if (jcrValue == 1)
- {
- return new Boolean(true);
- }
- else
- {
- return new Boolean(false);
- }
- }
- catch (Exception e)
- {
- throw new IncorrectAtomicTypeException("Impossible to convert the value : " + value.toString() , e);
- }
+ try
+ {
+ long jcrValue = value.getLong();
+ if (jcrValue == 1)
+ {
+ return new Boolean(true);
+ }
+ else
+ {
+ return new Boolean(false);
+ }
}
-
- /**
- *
- * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getStringValue(java.lang.Object)
- */
- public String getStringValue(Object object)
- {
-
- return ((Boolean) object).booleanValue() ? "1" : "0";
- }
+ catch (Exception e)
+ {
+ throw new IncorrectAtomicTypeException("Impossible to convert the value : " + value.toString() , e);
+ }
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getStringValue(java.lang.Object)
+ */
+ public String getStringValue(Object object)
+ {
+
+ return ((Boolean) object).booleanValue() ? "1" : "0";
+ }
}
-]]></source>
-
- </li>
- </ol>
- </p>
-
-
- </subsection>
- </section>
- </body>
+]]></source>
+
+ </li>
+ </ol>
+ </p>
+
+
+ </subsection>
+ </section>
+ </body>
</document>
|