You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "kazim_ssuet@yahoo.com" <ka...@yahoo.com> on 2010/10/11 23:41:22 UTC

Browse Jackrabbit repository using UUID

I have a mix:referenceable node and I can get UUID for that node using
node.getIdentifier() or node.getUUID().
How would I create a url to directly access this document in browser using
the UUID?

for example, I have a worksheet in repository that I can access thru url 
http://localhost:8080/repository/default/posts/attachements/doc1.xls

I need to use UUID in url rather than full path to file, if possible. Any
ideas?
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2990730.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Browse Jackrabbit repository using UUID

Posted by "kazim_ssuet@yahoo.com" <ka...@yahoo.com>.
pls help
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2991802.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Browse Jackrabbit repository using UUID

Posted by "kazim_ssuet@yahoo.com" <ka...@yahoo.com>.
Any thoughts on the assumptions I made in my previous post?

Stating the assumtions again:

1. fetching by uuid is not dependent on how many number of children are
under a parent, since no tree structure needs to be created for fetch by
uuid.

2. There is no referencial integrity involved if we make a node
mix:referenceble just to assign it a uuid, and don't reference that node
from anywhere.

Also, I havn't got any solutions of creating an http url using uuid that can
render a document in browser window.
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2993747.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Browse Jackrabbit repository using UUID

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Oct 12, 2010 at 17:31, kazim_ssuet@yahoo.com
<ka...@yahoo.com> wrote:
> I want to use UUID and not path, because, I think somewhere in memory whole
> path needs to be created if you fetch documents by path and fetching by UUID
> is supposed to be faster.
> I also read somewhere that performance starts degrading when there are alot
> of child nodes under a parent. In my application documents will be added
> pretty rapidly through automated procedures. I assume too many child nodes
> will not have an effect while fetching by UUID.

No, I don't think so. Once a node has been fetched, operations are
executed the same way (eg. looking up child nodes, access control,
etc.), regardless how it was fetched.

To make imports fast, do this:
- larger batches of session.save()
- if you have more than a few thousand / 10k child nodes per node,
rethink your content structure and introduce additional layers (like
the date structure you mention)

> I know there are suggestions to use dates in path to overcome the problem of
> too many child nodes gathering under one parent, but it might not be
> possible in my case.

Why not? Also, dates are just one suggestion that often works, but you
can use any other element from your domain model. Like categories,
people names, site names, customer names, etc.

> About the "References considered harmful" link that you suggested... I am
> not referencing the mix:referencable node from anywhere, I am just making it
> mix:referencable to assign it a UUID and it is a node of type
> JcrConstants.NT_FILE which is child of a node type JcrConstants.NT_FOLDER,
> while folder node is not referencing file node, so no referencial intigrity
> involved I guess.

Ok, referential integrity comes into play when you use the REFERENCE
property type only. But still, paths are much better:

- backup and copy to a different repository, where the UUIDs are
different, makes the references useless
- compare looking at a reference of
"35ee780f-343e-418b-a6e2-f069acd45921" vs.
/content/burger_king/orders/2010/10/13/large-meal-with-fries-11-14
- you can search for references of a subtree: jcr:like(@pathprop,
'/content/burger_king/%'
- the path is already the primary key for each node

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Browse Jackrabbit repository using UUID

Posted by "kazim_ssuet@yahoo.com" <ka...@yahoo.com>.
I want to use UUID and not path, because, I think somewhere in memory whole
path needs to be created if you fetch documents by path and fetching by UUID
is supposed to be faster. 
I also read somewhere that performance starts degrading when there are alot
of child nodes under a parent. In my application documents will be added
pretty rapidly through automated procedures. I assume too many child nodes
will not have an effect while fetching by UUID.

I know there are suggestions to use dates in path to overcome the problem of
too many child nodes gathering under one parent, but it might not be
possible in my case.

About the "References considered harmful" link that you suggested... I am
not referencing the mix:referencable node from anywhere, I am just making it
mix:referencable to assign it a UUID and it is a node of type
JcrConstants.NT_FILE which is child of a node type JcrConstants.NT_FOLDER,
while folder node is not referencing file node, so no referencial intigrity
involved I guess.

Just started looking at jackrabbit last week, pretty new to it, so i might
be wgong about my assumption above.
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2992127.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Browse Jackrabbit repository using UUID

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Oct 12, 2010 at 17:01, Alexander Klimetschek <ak...@day.com> wrote:
> On Tue, Oct 12, 2010 at 16:48, kazim_ssuet@yahoo.com
> <ka...@yahoo.com> wrote:
>> On that hyperlink, I would like to fetch document using http url that uses UUID instead
>> of path.
>
> Why the UUID and not the path of the document?

I forgot: I suggest to use string (or path) properties to link to the
other document(s), with the value being their paths.

See also http://wiki.apache.org/jackrabbit/DavidsModel#Rule_.235:_References_considered_harmful.
and previous discussions on the mailing list archives.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Browse Jackrabbit repository using UUID

Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Oct 12, 2010 at 16:48, kazim_ssuet@yahoo.com
<ka...@yahoo.com> wrote:
> On that hyperlink, I would like to fetch document using http url that uses UUID instead
> of path.

Why the UUID and not the path of the document?

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Browse Jackrabbit repository using UUID

Posted by Douglas José <do...@gmail.com>.
Hi,

If I got it right, you're asking if Jackrabbit already has a feature
to retrieve a node given an UUID, instead of a path,
once the entity you mention keeps a list of UUIDs to know which
documents are associated to it.
I believe Jackrabbit has no such feature, and I think you should
consider Alexander's suggestion and store the paths instead of the
UUIDs in your entity.
If for some reason you must keep using UUIDs, a servlet which
retrieves the UUID, resolves the correponding node and does a redirect
to its path should not be very complicated to implement.

Kind regards,

Douglas


On Tue, Oct 12, 2010 at 16:48, kazim_ssuet@yahoo.com
<ka...@yahoo.com> wrote:
>
> Hi Douglas,
>
> In my application there is a webpage that displays list of associated
> documents to an entity. That list can be fetched using path to the
> JcrConstants.NT_FOLDER node in jackrabbit repository for the particular
> entity.
>
> Now, on the web page that lists all associated documents, a user can click
> on one of the documents and it should open in a browser popup window. Since
> jackrabit server already provides http access and it renders document
> according to it's mime type I don't have to do all that...All i need to do
> is to create a url to use as href tag on the document link....On that hyper
> link, I would like to fetch document using http url that uses UUID instead
> of path.
>
> So, I was wondering if there is a way to access a document in browser window
> using UUID...something like this
> http://localhost:8080/repository/default/uuid_of_document
>
> Let me know if you need more info.
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2992057.html
> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.
>



-- 
Douglas Jose
http://douglasjose.com

- "Use free software. Help us make a free world."

Re: Browse Jackrabbit repository using UUID

Posted by "kazim_ssuet@yahoo.com" <ka...@yahoo.com>.
Hi Douglas, 

In my application there is a webpage that displays list of associated
documents to an entity. That list can be fetched using path to the
JcrConstants.NT_FOLDER node in jackrabbit repository for the particular
entity.

Now, on the web page that lists all associated documents, a user can click
on one of the documents and it should open in a browser popup window. Since
jackrabit server already provides http access and it renders document
according to it's mime type I don't have to do all that...All i need to do
is to create a url to use as href tag on the document link....On that hyper
link, I would like to fetch document using http url that uses UUID instead
of path.

So, I was wondering if there is a way to access a document in browser window
using UUID...something like this
http://localhost:8080/repository/default/uuid_of_document

Let me know if you need more info.
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2992057.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Browse Jackrabbit repository using UUID

Posted by Douglas José <do...@gmail.com>.
Hi,

I don't really understand the objective of use the UUID instead of the
path, can you please explain what is the motivation to do that?

Nevertheless, one alternative would be to implement a servlet which
gets the UUID as a parameter, retrieves the corresponding node and
renders it back to the user.

Kind regards,

Douglas

On Mon, Oct 11, 2010 at 23:41, kazim_ssuet@yahoo.com
<ka...@yahoo.com> wrote:
>
> I have a mix:referenceable node and I can get UUID for that node using
> node.getIdentifier() or node.getUUID().
> How would I create a url to directly access this document in browser using
> the UUID?
>
> for example, I have a worksheet in repository that I can access thru url
> http://localhost:8080/repository/default/posts/attachements/doc1.xls
>
> I need to use UUID in url rather than full path to file, if possible. Any
> ideas?
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Browse-Jackrabbit-repository-using-UUID-tp2990730p2990730.html
> Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.



--
Douglas Jose
http://douglasjose.com

- "Use free software. Help us make a free world."