You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2008/01/02 01:37:25 UTC
svn commit: r607952 [2/2] - in
/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm: ./
advanced-strategies/ api/ simple-strategies/
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/bean-strategy.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/bean-strategy.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/bean-strategy.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/bean-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,118 +16,118 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Simple Object Mapping Strategies</title>
- </properties>
- <body>
-
- <section name="Mapping Bean Fields">
- <subsection name="Introduction">
- <p>The bean-descriptor maps a bean attribute into one JCR node (or a set of properties). Generally, this attribute is an object based on a custom class.</p>
- <p>Based on our model defined <a href="introduction-strategies.html">here</a>, the following bean-descriptor is used to map the bean field "pageInfo" (PageInfo class) into the JCR node called "pageInfo".</p>
-
- <p align="center"> <img src="../images/bean-fields-def.jpg" ></img></p>
-
- <p>The PageInfo class has a corresponding class-descriptor in the mapping file.
- By this way, the Persistence Manager can map each PageInfo attributes.
- It is not necessary to specify the type in the bean-descriptor. The Persistence Manager uses the java introspection to get information on the each bean fields.</p>
-
- </subsection>
-
- <subsection name ="The JCR Structure">
- <p>
- Following our example, the resulting JCR structure is:
- </p>
- <p>
- <source><![CDATA[
-/mysite/page1
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Simple Object Mapping Strategies</title>
+ </properties>
+ <body>
+
+ <section name="Mapping Bean Fields">
+ <subsection name="Introduction">
+ <p>The bean-descriptor maps a bean attribute into one JCR node (or a set of properties). Generally, this attribute is an object based on a custom class.</p>
+ <p>Based on our model defined <a href="introduction-strategies.html">here</a>, the following bean-descriptor is used to map the bean field "pageInfo" (PageInfo class) into the JCR node called "pageInfo".</p>
+
+ <p align="center"> <img src="../images/bean-fields-def.jpg" ></img></p>
+
+ <p>The PageInfo class has a corresponding class-descriptor in the mapping file.
+ By this way, the Persistence Manager can map each PageInfo attributes.
+ It is not necessary to specify the type in the bean-descriptor. The Persistence Manager uses the java introspection to get information on the each bean fields.</p>
+
+ </subsection>
+
+ <subsection name ="The JCR Structure">
+ <p>
+ Following our example, the resulting JCR structure is:
+ </p>
+ <p>
+ <source><![CDATA[
+/mysite/page1
/mysite/page1/pageInfo
graffito:title = "This is my page title"
graffito:description = "This is my page description"
- ... other subnodes for page1 ...
- ]]></source>
- </p>
- <p>
- By default, the persistence manager will create a subnode (/mysite/page1/pageInfo) for the bean-descriptor pageInfo.
- </p>
-
-
- </subsection>
- <subsection name ="Using Another Bean Converter">
- <p>
- The OCM framework gives you the freedom to choose another kind of mapping for bean fields.
- For example, you can use a custom bean converter to access to the parent node (see the next section below).
- </p>
- <p>
- This can be done by writting your own bean converter class and reference this class in the bean-descriptor.
- </p>
- </subsection>
- <subsection name ="Predefined Bean Converters">
- <p>
- Here is the list of existing custom bean converters :
- </p>
- <table>
- <tr>
- <th>Custom Bean Converter Class</th>
- <th>Description</th>
- </tr>
- <tr>
- <td>
- org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl
- </td>
- <td>
- Map a bean field to the parent node. it is used to access to the parent object in readonly mode.
- See below the example based on a Folder object.
- </td>
- </tr>
- <tr>
- <td>
- org.apache.portals.graffito.jcr.persistence.beanconverter.impl.InlineBeanConverterImpl
- </td>
- <td>
- Bean converter used to map some node properties into one nested bean field.
- The corresponding bean field is not associated to a subnode.
- </td>
- </tr>
- </table>
- <p>
- If you want to use one of this bean converter, you have to reference it into a bean-field descriptor.
- </p>
-
- <p>
- The following descriptor bean-descriptor contains a reference to its parent folder (parentFolder attribute).
- Now the CmsObjectImpl object has an attribute (parentFolder) that contains a reference to the parent node.
- </p>
-<source><![CDATA[
-<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl"
+ ... other subnodes for page1 ...
+ ]]></source>
+ </p>
+ <p>
+ By default, the persistence manager will create a subnode (/mysite/page1/pageInfo) for the bean-descriptor pageInfo.
+ </p>
+
+
+ </subsection>
+ <subsection name ="Using Another Bean Converter">
+ <p>
+ The OCM framework gives you the freedom to choose another kind of mapping for bean fields.
+ For example, you can use a custom bean converter to access to the parent node (see the next section below).
+ </p>
+ <p>
+ This can be done by writting your own bean converter class and reference this class in the bean-descriptor.
+ </p>
+ </subsection>
+ <subsection name ="Predefined Bean Converters">
+ <p>
+ Here is the list of existing custom bean converters :
+ </p>
+ <table>
+ <tr>
+ <th>Custom Bean Converter Class</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td>
+ org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl
+ </td>
+ <td>
+ Map a bean field to the parent node. it is used to access to the parent object in readonly mode.
+ See below the example based on a Folder object.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ org.apache.portals.graffito.jcr.persistence.beanconverter.impl.InlineBeanConverterImpl
+ </td>
+ <td>
+ Bean converter used to map some node properties into one nested bean field.
+ The corresponding bean field is not associated to a subnode.
+ </td>
+ </tr>
+ </table>
+ <p>
+ If you want to use one of this bean converter, you have to reference it into a bean-field descriptor.
+ </p>
+
+ <p>
+ The following descriptor bean-descriptor contains a reference to its parent folder (parentFolder attribute).
+ Now the CmsObjectImpl object has an attribute (parentFolder) that contains a reference to the parent node.
+ </p>
+<source><![CDATA[
+<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl"
jcrType="graffito:cmsobjectimpl" >
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="name" jcrName="graffito:name" id="true" />
- <bean-descriptor fieldName="parentFolder"
- converter="org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl" />
-
-</class-descriptor>
-]]></source>
- </subsection>
- <subsection name ="Building your own Bean Converters">
- <p>
- Here is the different steps used to create a new bean converter :
- </p>
- <ol>
- <li>Specify the converter class in the bean descriptor :
-<source><![CDATA[
-<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl"
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="name" jcrName="graffito:name" id="true" />
+ <bean-descriptor fieldName="parentFolder"
+ converter="org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl" />
+
+</class-descriptor>
+]]></source>
+ </subsection>
+ <subsection name ="Building your own Bean Converters">
+ <p>
+ Here is the different steps used to create a new bean converter :
+ </p>
+ <ol>
+ <li>Specify the converter class in the bean descriptor :
+<source><![CDATA[
+<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl"
jcrType="graffito:cmsobjectimpl" >
- <bean-descriptor fieldName="parentFolder"
- converter="org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl" />
-</class-descriptor>
-]]></source>
- </li>
- <li>Implement the converter class (based on the interface org.apache.portals.graffito.jcr.persistence.beanconverter.BeanConverter).
+ <bean-descriptor fieldName="parentFolder"
+ converter="org.apache.portals.graffito.jcr.persistence.beanconverter.impl.ParentBeanConverterImpl" />
+</class-descriptor>
+]]></source>
+ </li>
+ <li>Implement the converter class (based on the interface org.apache.portals.graffito.jcr.persistence.beanconverter.BeanConverter).
You bean converter class can also extends the class AbstractBeanConverterImpl to have a default implementation for some methods.
-<source><![CDATA[
+<source><![CDATA[
import javax.jcr.Node;
import javax.jcr.Session;
@@ -143,57 +143,57 @@
import org.apache.portals.graffito.jcr.persistence.beanconverter.BeanConverter;
import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
/**
- *
+ *
* Bean converter used to access to the parent object.
- *
- *
+ *
+ *
* @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
*
*/
public class ParentBeanConverterImpl extends AbstractBeanConverterImpl implements BeanConverter {
- private final static Log log = LogFactory.getLog(ParentBeanConverterImpl.class);
-
- public ParentBeanConverterImpl(Mapper mapper, ObjectConverter objectConverter, AtomicTypeConverterProvider atomicTypeConverterProvider)
- {
- super(mapper, objectConverter, atomicTypeConverterProvider);
- }
-
- public void insert(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
- throws PersistenceException, RepositoryException, JcrMappingException {
-
- // Add code to insert the object
- }
-
- public void update(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
- throws PersistenceException, RepositoryException, JcrMappingException {
-
- // Add code to update the object
- }
-
- public Object getObject(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Class beanClass, Object parent)
- throws PersistenceException, RepositoryException,JcrMappingException {
-
- // Add code to retrieve the object
- }
-
- public void remove(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
- throws PersistenceException, RepositoryException, JcrMappingException {
-
- // Add the code to remove the object
- }
-
+ private final static Log log = LogFactory.getLog(ParentBeanConverterImpl.class);
+
+ public ParentBeanConverterImpl(Mapper mapper, ObjectConverter objectConverter, AtomicTypeConverterProvider atomicTypeConverterProvider)
+ {
+ super(mapper, objectConverter, atomicTypeConverterProvider);
+ }
+
+ public void insert(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
+ throws PersistenceException, RepositoryException, JcrMappingException {
+
+ // Add code to insert the object
+ }
+
+ public void update(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
+ throws PersistenceException, RepositoryException, JcrMappingException {
+
+ // Add code to update the object
+ }
+
+ public Object getObject(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Class beanClass, Object parent)
+ throws PersistenceException, RepositoryException,JcrMappingException {
+
+ // Add code to retrieve the object
+ }
+
+ public void remove(Session session, Node parentNode, BeanDescriptor beanDescriptor, ClassDescriptor beanClassDescriptor, Object object, ClassDescriptor parentClassDescriptor, Object parent)
+ throws PersistenceException, RepositoryException, JcrMappingException {
+
+ // Add the code to remove the object
+ }
+
}
-
-]]></source>
-
- </li>
- </ol>
-
- </subsection>
-
- </section>
- </body>
+
+]]></source>
+
+ </li>
+ </ol>
+
+ </subsection>
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/collection-strategy.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/collection-strategy.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/collection-strategy.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/collection-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,101 +16,101 @@
limitations under the License.
-->
<document>
- <properties>
- <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
- <title>Simple Object Mapping Strategies</title>
- </properties>
- <body>
-
- <section name="Mapping Collection Fields">
- <subsection name="Introduction">
- <p>The collection-descriptor maps a collection attribute into JCR nodes or in a multivalue property.</p>
- <p>Based on our model defined <a href="introduction-strategies.html">here</a>, the following collection-descriptor is used to map the "paragraphs" field into the JCR node called "paragraphs".</p>
-
- <source><![CDATA[
+ <properties>
+ <author email="christophe.lombart@gmail.com">Christophe Lombart</author>
+ <title>Simple Object Mapping Strategies</title>
+ </properties>
+ <body>
+
+ <section name="Mapping Collection Fields">
+ <subsection name="Introduction">
+ <p>The collection-descriptor maps a collection attribute into JCR nodes or in a multivalue property.</p>
+ <p>Based on our model defined <a href="introduction-strategies.html">here</a>, the following collection-descriptor is used to map the "paragraphs" field into the JCR node called "paragraphs".</p>
+
+ <source><![CDATA[
<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrType="graffito:page">
- <collection-descriptor fieldName="paragraphs" jcrName="paragraphs"
- elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph" />
- <!-- other field, bean and collection mapping here !-->
+ <collection-descriptor fieldName="paragraphs" jcrName="paragraphs"
+ elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph" />
+ <!-- other field, bean and collection mapping here !-->
</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"/>
-</class-descriptor>
- ]]></source>
-
- <p>
- The collection-descriptor contains the elementClassName attribute which specify the collection element class.
- A class descriptor for the element class has also to be defined.
-
- </p>
-
- </subsection>
-
- <subsection name ="The JCR Structure">
- <p>
- Following our example, the resulting JCR structure is :
- </p>
- <p>
- <source><![CDATA[
-/mysite/page1
- /mysite/page1/paragraphs
- /mysite/page1/paragraphs/collection-element1
- graffito:text = "This is the content of para1"
- /mysite/page1/paragraphs/collection-element2
- graffito:text = "This is the content of para2"
- ... other subnodes for page1 ...
- ]]></source>
- </p>
- <p>
-
- By default, the persistence manager will create a subnode (/mysite/page1/paragraphs).
- This one will contains the different paragraphs.
- </p>
- <p>
- As explained in the following sections, it is possible to map to another JCR structure.
- It is also possible to use another name for the jcr node names (see above).
- </p>
-
- </subsection>
-
-
- <subsection name="Supported Collection and Map Types">
- <p>
- The OCM framework is supporting the following java types :
-
- <ol>
- <li>Collections : Collection, List, Set, ArrayList, Vector, HashSet.</li>
- <li>Maps : Map, HashMap</li>
- </ol>
- </p>
-
- </subsection>
-
- <subsection name ="Using Another Collection or Map">
- <p>
- It is possible to support other Collection or Map types with the ManageableCollection interface.
- </p>
- </subsection>
-
- <subsection name ="Using Another Collection Converter">
- <p>
- TO DO
- </p>
- </subsection>
- <subsection name ="Predefined Collection Converters">
- <p>
- TO DO
- </p>
- </subsection>
- <subsection name ="Building your own Collection Converters">
- <p>
- TO DO
- </p>
- </subsection>
-
-
- </section>
- </body>
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="graffito:text"/>
+</class-descriptor>
+ ]]></source>
+
+ <p>
+ The collection-descriptor contains the elementClassName attribute which specify the collection element class.
+ A class descriptor for the element class has also to be defined.
+
+ </p>
+
+ </subsection>
+
+ <subsection name ="The JCR Structure">
+ <p>
+ Following our example, the resulting JCR structure is :
+ </p>
+ <p>
+ <source><![CDATA[
+/mysite/page1
+ /mysite/page1/paragraphs
+ /mysite/page1/paragraphs/collection-element1
+ graffito:text = "This is the content of para1"
+ /mysite/page1/paragraphs/collection-element2
+ graffito:text = "This is the content of para2"
+ ... other subnodes for page1 ...
+ ]]></source>
+ </p>
+ <p>
+
+ By default, the persistence manager will create a subnode (/mysite/page1/paragraphs).
+ This one will contains the different paragraphs.
+ </p>
+ <p>
+ As explained in the following sections, it is possible to map to another JCR structure.
+ It is also possible to use another name for the jcr node names (see above).
+ </p>
+
+ </subsection>
+
+
+ <subsection name="Supported Collection and Map Types">
+ <p>
+ The OCM framework is supporting the following java types :
+
+ <ol>
+ <li>Collections : Collection, List, Set, ArrayList, Vector, HashSet.</li>
+ <li>Maps : Map, HashMap</li>
+ </ol>
+ </p>
+
+ </subsection>
+
+ <subsection name ="Using Another Collection or Map">
+ <p>
+ It is possible to support other Collection or Map types with the ManageableCollection interface.
+ </p>
+ </subsection>
+
+ <subsection name ="Using Another Collection Converter">
+ <p>
+ TO DO
+ </p>
+ </subsection>
+ <subsection name ="Predefined Collection Converters">
+ <p>
+ TO DO
+ </p>
+ </subsection>
+ <subsection name ="Building your own Collection Converters">
+ <p>
+ TO DO
+ </p>
+ </subsection>
+
+
+ </section>
+ </body>
</document>
Modified: jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/introduction-strategies.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/introduction-strategies.xml?rev=607952&r1=607951&r2=607952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-strategies/introduction-strategies.xml (original)
+++ jackrabbit/trunk/jackrabbit-site/src/site/xdoc/ocm/simple-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,137 +16,137 @@
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 java class into JCR nodes and/or properties.
- </p>
- <subsection name="The Object Model">
- <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>
- <p align="center"><img src="../images/sample-model-doc.png" ></img></p>
- <p>
- This object model could be too simple for real applications and it is just used here to simplify the description of the different mapping strategies.
- </p>
- </subsection>
- <subsection name="The Java Classes">
- <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 java class into JCR nodes and/or properties.
+ </p>
+ <subsection name="The Object Model">
+ <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>
+ <p align="center"><img src="../images/sample-model-doc.png" ></img></p>
+ <p>
+ This object model could be too simple for real applications and it is just used here to simplify the description of the different mapping strategies.
+ </p>
+ </subsection>
+ <subsection name="The Java Classes">
+ <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>
- <subsection name="The JCR Structure">
+ </source>
+ </subsection>
+ <subsection name="The JCR Structure">
<p>
Here is the resulting JCR structure if the page is stored on the path "/mysite/mypage1" and contains 2 paragraphs :
- </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.
- See the sections <a href="atomic-strategy.html">Mapping Atomic Fields</a>, <a href="bean-strategy.html">Mapping Bean Fields</a>, <a href="collection-strategy.html">Mapping Collection Fields</a> to get more information on that.</p>
-
- </subsection>
- <subsection name="The Class Descriptors">
- <p>
- When you decide to map a bean class, you have to create a new class descriptor entry in the Persistence Manager descriptor file.
- Let's start with the simplest class-descriptor :
- </p>
- <p align="center"> <img src="../images/simple-classdescriptor-def.jpg" ></img></p>
- <p>
- This class descriptor maps the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" into the JCR type "nt:unstructured".
- Each field-descriptor maps one bean field into a JCR property. For example, the first field descriptor maps the java bean field "text" into the jcr property called "myjcrtext".
- The second field-descriptor is a specific case because it maps the jcr node path into a bean field called "path" (see below the section "The Path Field").
-
-
- 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 particular JCR node type by specifying the desired type in the attribute jcrType.
- The following class-descriptor map the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" into the node type "graffito:paragraph".
-
- </p>
-
- <p>Here are the class-descriptors required to map the classes Page, PageInfo and Paragraph :</p>
- <p align="center"><img src="../images/other-descriptors.jpg" ></img></p>
- <p>
- In order to use correctly 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>
-
- <p align="center"><img src="../images/node-type-def.jpg" ></img></p>
- <p>
- Of course, node types "Graffito:Page" and "Graffito:PageInfo" are also 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 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[
+ </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.
+ See the sections <a href="atomic-strategy.html">Mapping Atomic Fields</a>, <a href="bean-strategy.html">Mapping Bean Fields</a>, <a href="collection-strategy.html">Mapping Collection Fields</a> to get more information on that.</p>
+
+ </subsection>
+ <subsection name="The Class Descriptors">
+ <p>
+ When you decide to map a bean class, you have to create a new class descriptor entry in the Persistence Manager descriptor file.
+ Let's start with the simplest class-descriptor :
+ </p>
+ <p align="center"> <img src="../images/simple-classdescriptor-def.jpg" ></img></p>
+ <p>
+ This class descriptor maps the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" into the JCR type "nt:unstructured".
+ Each field-descriptor maps one bean field into a JCR property. For example, the first field descriptor maps the java bean field "text" into the jcr property called "myjcrtext".
+ The second field-descriptor is a specific case because it maps the jcr node path into a bean field called "path" (see below the section "The Path Field").
+
+
+ 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 particular JCR node type by specifying the desired type in the attribute jcrType.
+ The following class-descriptor map the class "org.apache.portals.graffito.jcr.testmodel.Paragraph" into the node type "graffito:paragraph".
+
+ </p>
+
+ <p>Here are the class-descriptors required to map the classes Page, PageInfo and Paragraph :</p>
+ <p align="center"><img src="../images/other-descriptors.jpg" ></img></p>
+ <p>
+ In order to use correctly 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>
+
+ <p align="center"><img src="../images/node-type-def.jpg" ></img></p>
+ <p>
+ Of course, node types "Graffito:Page" and "Graffito:PageInfo" are also 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 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>