You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Oliver Kiessler <ol...@gmail.com> on 2004/12/17 00:57:21 UTC
Referenceable nodes
hi,
are referenceable nodes already available in jackrabbit? I was reading
the spec and found a method called
parentNode.addExistingNode("/some/path") but could not find it in
jackrabbit...
cheers,
oliver
Re: Referenceable nodes
Posted by Oliver Kiessler <ol...@gmail.com>.
On Fri, 17 Dec 2004 11:39:43 +0100, Peeter Piegaze
<pe...@gmail.com> wrote:
> Yes, referenceable nodes are available. You create one by adding a
> mixin node type to an existing node
>
> someNode.addMixin("mix:referenceable")
>
> What you are referring to is an old method no longer available that
> supported "hardlinks" which allowed a node to have more than one
> parent.
>
> Being referencable was a precondition of being hardlinked, but
> hardlinks have been removed from the spec.
>
> But referenceable-ness is still significant because it allows a node
> to pointed to by a property of type REFERENCE elsewhere in WS.
>
> Once you have your node with mixin mix:referenceable you can create a
> REFERENCE property that points to it like this
>
> someOtherNode.addProperty("myRefProp", someNode)
>
> Then you can traverse that link like this
>
> Property myRefProp = someOtherNode.getProperty("myRefProp")
> Node myNode = myRefProp.getNode();
>
> At this point myNode and someNode are distinct objects that represent
> the same actual node in the repository.
>
> Hope this helps
>
> Cheers,
> Peeter
thanks, peeter!
It works fine, this is what the nodes look like:
/global/users
->/global/users/jcr:primaryType=nt:unstructured
->/global/users/jcr:mixinTypes=mix:referenceable
->/global/users/jcr:mixinTypes=mix:versionable
->/global/users/jcr:uuid=3f78f1e6-7bd5-41dc-8f49-4c1478cf1e96
->/global/users/description=Global users node.
->/global/users/jcr:versionHistory=c1f19b79-8347-4273-be21-5aca8879085e
->/global/users/jcr:baseVersion=2d1a5200-9d81-4faf-8135-b6bb6be6321a
->/global/users/jcr:isCheckedOut=true
->/global/users/jcr:predecessors=2d1a5200-9d81-4faf-8135-b6bb6be6321a
/global/users/oliver
->/global/users/oliver/jcr:primaryType=nt:unstructured
->/global/users/oliver/jcr:mixinTypes=mix:referenceable
->/global/users/oliver/jcr:uuid=221257ce-22ff-4037-bf9e-1a7b99af1c71
->/global/users/oliver/password=test
/domains/default/users/oliver
->/domains/default/users/oliver/jcr:primaryType=nt:unstructured
->/domains/default/users/oliver/globalUserReference=221257ce-22ff-4037-bf9e-1a7b99af1c71
cheers,
oliver
Re: Referenceable nodes
Posted by Peeter Piegaze <pe...@gmail.com>.
Yes, referenceable nodes are available. You create one by adding a
mixin node type to an existing node
someNode.addMixin("mix:referenceable")
What you are referring to is an old method no longer available that
supported "hardlinks" which allowed a node to have more than one
parent.
Being referencable was a precondition of being hardlinked, but
hardlinks have been removed from the spec.
But referenceable-ness is still significant because it allows a node
to pointed to by a property of type REFERENCE elsewhere in WS.
Once you have your node with mixin mix:referenceable you can create a
REFERENCE property that points to it like this
someOtherNode.addProperty("myRefProp", someNode)
Then you can traverse that link like this
Property myRefProp = someOtherNode.getProperty("myRefProp")
Node myNode = myRefProp.getNode();
At this point myNode and someNode are distinct objects that represent
the same actual node in the repository.
Hope this helps
Cheers,
Peeter
On Fri, 17 Dec 2004 00:57:21 +0100, Oliver Kiessler
<ol...@gmail.com> wrote:
> hi,
> are referenceable nodes already available in jackrabbit? I was reading
> the spec and found a method called
> parentNode.addExistingNode("/some/path") but could not find it in
> jackrabbit...
>
> cheers,
> oliver
>