jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart" <christophe.lomb...@gmail.com>
Subject Re: OCM and custom_nodetypes.xml
Date Tue, 02 Dec 2008 14:34:55 GMT
On Mon, Dec 1, 2008 at 22:40, majohnst <matt@lattaoutdoors.com> wrote:

>
> If I am using OCM annotations, do I have to use the custom_nodetypes.xml?


no, this is not mandatory in all cases. Furthermore, the usage of the
custom_nodetypes is not depending on the OCM annotations or the OCM XML
mapping file. Let me explain ...

In some conditions, OCM needs a *discriminator ( = jcr property* of type
String) that contains the class name to be used for instantiation. This node
property must be named "ocm_classname". On loading objects from the jcr
repository, OCM checks this attribute and instantiates objects of this
type.  This property is not intrusive because it is not necessary to map it
into your java class attribute. It is only used internally by the Object
Content Manager and again, it is not used in all cases (see below)

Here is a summary of the different possibilities :

1. Mapping all java classes into  the node type "nt:unstructured" :
- The mixin "ocm:discriminator" is not necessary, so no need to add it into
custom_nodetypes.xml.
- OCM will add an extra property calle ocm_classname.

2. Mapping each java class to a different node type.
- The mixin "ocm:discriminator" is not necessary, so no need to add it into
custom_nodetypes.xml.
- Futhermore, the ocm_classname property will not be created.

3. Mapping  several java classes into the same node type.
- The mixin "ocm:discriminator" is not necessary if the node type gives you
the ability to add a String property. If not, the ocm will use the mixin
ocm:discriminator.


Let me know if it is not clear.

Christophe




OCM uses a mixin node type called "ocm:discriminator" which can be added
into the custom_nodetypes.xml [1] or by using the CND notation [2].


[1] The ocm:discriminator definition :


<nodeType name="ocm:discriminator" isMixin="true">
    <supertypes>
      <supertype>nt:base</supertype>
    </supertypes>
    <propertyDefinition name="ocm_classname" requiredType="String"
autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false" />
  </nodeType>


[2] http://jackrabbit.apache.org/node-type-notation.html

> If
> I make changes to properties in the custom_nodetypes.xml used for an
> existing repository, will those changes affect the existing repository?
> --
> View this message in context:
> http://www.nabble.com/OCM-and-custom_nodetypes.xml-tp20781136p20781136.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message