You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jerome Banks <je...@gmail.com> on 2008/06/23 20:02:50 UTC

Custom PersistenceManagers - How can I get the path associated with a NodeId?

Hey Folks,
  I'm trying to implement a custom PersistenceManager, and I'm running into
some difficulties.

I'd like to create a PersistenceManager where Nodes are stored on a
filesystem, in a Folder corresponding the path of the Node in the
Repository.  This way we could have nt:file file nodes which are accessible
by non-JCR clients, simply as files on a filesystem.

However, the methods provided to PersistenceManager only seem to pass in
NodeId or PropertyId, which don't seem to have a path, but simply a UUID.
It looks like various components in Jackrabbit are able to store items on
the filesystem, but they do so by chopping up the UUID, and creating their
own path.  Is there any reason we couldn't just use the Node's path to start
out with?  From the JCR API perspective, it is alway available when a Node
or Property is created. Why can't it be accessed by the PersistenceManager?

  Any hints on how to accomplish my goal?  I want to be able to store items
(basically binary properties ) on a filesystem, according to their path in
the repository.

thx ...

Re: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Jerome Banks <je...@gmail.com>.
Folks,
  Thanks for the replies.  The SPI interface is a possibility, but I was
under the impression that it was read-only. That might be the cleanest
solution

   I've been poking around, at noticed that the internal HierarchyManager
class has methods to convert from the ItemId to a  Path.  Is there any
reason not to expose the HierarchyManager, perhaps from the PMContext
object?  Otherwise, is there a way to get the HierarchyManager? It looks
like there is one associated with the Workspace, one with the Session.  Is
there an easy way to access the Workspace or the Session from the PM?

thx ...
 --jerome

On Tue, Jun 24, 2008 at 7:32 AM, Alexander Klimetschek <ak...@day.com>
wrote:

> On Tue, Jun 24, 2008 at 4:03 AM, Ard Schrijvers
> <a....@onehippo.com> wrote:
> > Nodes in Jackrabbit do not have hierarchical information like its path,
> > but only its parent and its children. Storing path information like you
> > suggest might be handy in some parts, though at the same time makes
> > moving large subtrees almost impossible (at least very cpu and time
> > consuming): currently, moving a subtree of nodes is a very small
> > operation in jackrabbit. If you would store all hierarchical data the
> > way you suggest, you cannot easily move nodes anymore.
>
> If the underlying storage (here probably a standard file system) has
> its own abstraction (eg. inodes) for the hierarchical information,
> moving subtrees (= folders) is not a problem.
>
> And it depends on whether moving subtrees is an important use case -
> vs. retrieving nodes by path.
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>

Re: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jun 24, 2008 at 4:03 AM, Ard Schrijvers
<a....@onehippo.com> wrote:
> Nodes in Jackrabbit do not have hierarchical information like its path,
> but only its parent and its children. Storing path information like you
> suggest might be handy in some parts, though at the same time makes
> moving large subtrees almost impossible (at least very cpu and time
> consuming): currently, moving a subtree of nodes is a very small
> operation in jackrabbit. If you would store all hierarchical data the
> way you suggest, you cannot easily move nodes anymore.

If the underlying storage (here probably a standard file system) has
its own abstraction (eg. inodes) for the hierarchical information,
moving subtrees (= folders) is not a problem.

And it depends on whether moving subtrees is an important use case -
vs. retrieving nodes by path.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

RE: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Ard Schrijvers <a....@onehippo.com>.
Jerome Banks wrote:
> 
> However, the methods provided to PersistenceManager only seem 
> to pass in NodeId or PropertyId, which don't seem to have a 
> path, but simply a UUID.
> It looks like various components in Jackrabbit are able to 
> store items on the filesystem, but they do so by chopping up 
> the UUID, and creating their own path.  Is there any reason 
> we couldn't just use the Node's path to start out with?  From 

Nodes in Jackrabbit do not have hierarchical information like its path,
but only its parent and its children. Storing path information like you
suggest might be handy in some parts, though at the same time makes
moving large subtrees almost impossible (at least very cpu and time
consuming): currently, moving a subtree of nodes is a very small
operation in jackrabbit. If you would store all hierarchical data the
way you suggest, you cannot easily move nodes anymore.

-Ard

> the JCR API perspective, it is alway available when a Node or 
> Property is created. Why can't it be accessed by the 
> PersistenceManager?
> 
>   Any hints on how to accomplish my goal?  I want to be able 
> to store items (basically binary properties ) on a 
> filesystem, according to their path in the repository.
> 
> thx ...
> 

Re: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Alexander Klimetschek <ak...@day.com>.
No, unfortunately the PM interface does not allow this. It is designed
in a way that reduces the amount of operations that need to be
implemented (ie. making the PM simpler), which results in the use of
UUIDs as the central way of identifying nodes and their properties.
Unfortunately that makes it difficult to write PMs that are more
"intelligent" or have access to the hierarchy information.

Regards,
Alex

On Mon, Jun 23, 2008 at 2:02 PM, Jerome Banks <je...@gmail.com> wrote:
> Hey Folks,
>  I'm trying to implement a custom PersistenceManager, and I'm running into
> some difficulties.
>
> I'd like to create a PersistenceManager where Nodes are stored on a
> filesystem, in a Folder corresponding the path of the Node in the
> Repository.  This way we could have nt:file file nodes which are accessible
> by non-JCR clients, simply as files on a filesystem.
>
> However, the methods provided to PersistenceManager only seem to pass in
> NodeId or PropertyId, which don't seem to have a path, but simply a UUID.
> It looks like various components in Jackrabbit are able to store items on
> the filesystem, but they do so by chopping up the UUID, and creating their
> own path.  Is there any reason we couldn't just use the Node's path to start
> out with?  From the JCR API perspective, it is alway available when a Node
> or Property is created. Why can't it be accessed by the PersistenceManager?
>
>  Any hints on how to accomplish my goal?  I want to be able to store items
> (basically binary properties ) on a filesystem, according to their path in
> the repository.
>
> thx ...
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

How to handle many concurrent access

Posted by Frederic BOY <fr...@gmail.com>.
Hello,

Thanks to your help guys, I've managed to get my central repository to
handle concurrent access from 5 computers in LAN configuration. 

To achieve that, I had to deploy a JCR-RMI server on the host of my central
repository.

Since then I have noticed some significant performance losses, especially
when it comes to search queries.

Next step for me now is to have this repository accessible at a production
level, i.e. to be able to handle up to 500 concurrent accesses (READ-ONLY
though). Based on what I have experienced with my LAN configuration, I am
concerned the JCR-RMI server solution will not be sufficient.

Has any of you been confronted to that problem?

Thanks in advance for your help!


Frederic Boy


Re: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Stefan Guggisberg <st...@day.com>.
hi jerome

On Mon, Jun 23, 2008 at 8:02 PM, Jerome Banks <je...@gmail.com> wrote:
> Hey Folks,
>  I'm trying to implement a custom PersistenceManager, and I'm running into
> some difficulties.
>
> I'd like to create a PersistenceManager where Nodes are stored on a
> filesystem, in a Folder corresponding the path of the Node in the
> Repository.  This way we could have nt:file file nodes which are accessible
> by non-JCR clients, simply as files on a filesystem.

this is not supported in jackrabbit and i certainly wouldn't recommend it.
the repository could get easily corrupted.

>
> However, the methods provided to PersistenceManager only seem to pass in
> NodeId or PropertyId, which don't seem to have a path, but simply a UUID.
> It looks like various components in Jackrabbit are able to store items on
> the filesystem, but they do so by chopping up the UUID, and creating their
> own path.  Is there any reason we couldn't just use the Node's path to start
> out with?  From the JCR API perspective, it is alway available when a Node
> or Property is created. Why can't it be accessed by the PersistenceManager?

PersistenceManager is not a SPI, it's a low-level api with a very
simple contract:
a PersistenceMananger basically stores and retrieves an object by id (much like
a hashmap. berkeley db, etc).

>
>  Any hints on how to accomplish my goal?  I want to be able to store items
> (basically binary properties ) on a filesystem, according to their path in
> the repository.

you could
- use webdav to access the 'files'
- implement the jackrabbit SPI (as marcel suggested)
- don't use jackrabbit at all but simply use the file system ;)

cheers
stefan

>
> thx ...
>

Re: Custom PersistenceManagers - How can I get the path associated with a NodeId?

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Jerome,

you might want to have a look at the SPI in Jackrabbit. It defines interfaces at 
a higher level than the persistence manager and allows an implementation to be 
path based. a major consequence however is, that you have to implement more 
operations compared to a persistence manager. while a persistence manager only 
implements CRUD, an SPI implementation needs to implement low level JCR operations.

regards
  marcel

Jerome Banks wrote:
> Hey Folks,
>   I'm trying to implement a custom PersistenceManager, and I'm running into
> some difficulties.
> 
> I'd like to create a PersistenceManager where Nodes are stored on a
> filesystem, in a Folder corresponding the path of the Node in the
> Repository.  This way we could have nt:file file nodes which are accessible
> by non-JCR clients, simply as files on a filesystem.
> 
> However, the methods provided to PersistenceManager only seem to pass in
> NodeId or PropertyId, which don't seem to have a path, but simply a UUID.
> It looks like various components in Jackrabbit are able to store items on
> the filesystem, but they do so by chopping up the UUID, and creating their
> own path.  Is there any reason we couldn't just use the Node's path to start
> out with?  From the JCR API perspective, it is alway available when a Node
> or Property is created. Why can't it be accessed by the PersistenceManager?
> 
>   Any hints on how to accomplish my goal?  I want to be able to store items
> (basically binary properties ) on a filesystem, according to their path in
> the repository.
> 
> thx ...
>