jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject Re: Adding a new property
Date Fri, 19 Sep 2008 07:49:02 GMT
kenclark wrote:
> As you will see, I am very new to Jackrabbit and JCR in general.
> I am working on storing binary content using nt:file.  I have this working.
> I would like to keep track of the user id of the user that saved the binary
> content.  It is clear to me that I can't just add a property of whatever
> name I like -- I need to (apparently) configure a new node type which
> extends from "jcr:content" (or maybe "nt:resource", I can't be sure.)
> I have been googling my head off for about an hour, and am totally unable to
> figure out how to do this.
> So:
> 1) Is it correct that I need to make a new node type?

Only if the node type you have doesn't allow residual properties (in 
which case you can just go ahead and set new properties). This is 
probably not the case here, otherwise you'd already be doing it. But it 
could be the case on other JCR implementations.

An alternative would be to go hunting for a existing *mixin* type that 
does allow setting arbitrary properties, and try to add it to given node 

> 2) How do I define it and then register it?  I would like this to be done in
> a portable way if possible so that I can hook up to different
> implementations of JCR without having to rewrite.

Not possible with JCR 1.0, but part of the JCR 2.0 (potentially the most 
important change!).

> 3) I have a web app which will be using this.  I assume the node type only
> needs to be registered once, but is that once per server startup or once
> ever or what?  What is the best architecture for doing this setup?

It would need to be done once.

> 4) Why is it so complicated to add a new property -- or have I totally
> missed the easy way to do this?

The JCR spec allows "strict" node types and "flexible" node types (which 
is good). Jackrabbit implements "nt:file/nt:resource" exactly as 
specified in the JCR spec, so doesn't make them less strict that they 
need to be. Not sure why.

BR, Julian

View raw message