You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jason Tesser <ja...@dotmarketing.com> on 2008/01/23 17:13:13 UTC

Setting UUID

Can I set the UUID of a node myself?  If so how?

-- 
Jason S. Tesser
Lead Programmer
www.dotmarketing.com
www.dotcms.org
Dotmarketing, Inc.
3059 Grand Avenue
Suite 440
Miami, FL 33133
T: 305.858.1422  x279
F: 786.594.5288

Re: Setting UUID

Posted by Marcel Reutegger <ma...@gmx.net>.
Thomas Mueller wrote:
> I think you could use Session or Workspace.importXML(...). But to do
> that, you need a correctly formatted XML file, and the unique IDs of
> your system must be UUIDs or converted to UUIDs (see
> http://en.wikipedia.org/wiki/UUID). The conversion could be done by
> creating a SHA-1 hash code or so.

for an example see method RepositoryServiceImpl.BatchImpl.createXMLFragement() 
in jackrabbit-spi2jcr [1].

regards
  marcel

[1] 
http://svn.apache.org/repos/asf/jackrabbit/tags/1.4/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java



Re: Setting UUID

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

I think you could use Session or Workspace.importXML(...). But to do
that, you need a correctly formatted XML file, and the unique IDs of
your system must be UUIDs or converted to UUIDs (see
http://en.wikipedia.org/wiki/UUID). The conversion could be done by
creating a SHA-1 hash code or so.

Regards,
Thomas

Re: Setting UUID

Posted by Fabián Mandelbaum <fm...@gmail.com>.
I see...

what about storing the system's unique IDs as a property for the node
instead? And then, use that property for
indexing/search/location/whatever_you_do_with_the_current_system ?

Just an idea...

Good luck!

Jason Tesser escribió:
> Well we are migrating our system to use JR and our data is structured.  Our
> system will be maintaining the structures as it currently does but the
> content itself will be stored in JR.  We have our own unique identifiers
> which our system will need to keep for every piece of content in JR.  I want
> to limit what happens with a save of a piece of content.  So I want to use
> our systems unique ids for the uuid in JR.
>
> On 1/23/08, Fabián Mandelbaum <fm...@gmail.com> wrote:
>   
>> Jason Tesser escribió:
>>     
>>> Can I set the UUID of a node myself?  If so how?
>>>
>>>
>>>       
>> If I remember correctly the way JackRabbit generates the UUIDs for nodes
>> is "magic" and "non-deterministic" ; meaning basically, that there's no
>> guarantee that the same node will get the same UUID if stored (all other
>> conditions, equal) on two different repos.
>>
>> Bottomline, I don't think it's a good idea to set the UUID yourself.
>>
>> If I may ask, which is your motivation to do so?
>>
>> Cheers.
>>
>>     
>
>
>
>   


Re: Setting UUID

Posted by Jason Tesser <ja...@dotmarketing.com>.
Well we are migrating our system to use JR and our data is structured.  Our
system will be maintaining the structures as it currently does but the
content itself will be stored in JR.  We have our own unique identifiers
which our system will need to keep for every piece of content in JR.  I want
to limit what happens with a save of a piece of content.  So I want to use
our systems unique ids for the uuid in JR.

On 1/23/08, Fabián Mandelbaum <fm...@gmail.com> wrote:
>
> Jason Tesser escribió:
> > Can I set the UUID of a node myself?  If so how?
> >
> >
> If I remember correctly the way JackRabbit generates the UUIDs for nodes
> is "magic" and "non-deterministic" ; meaning basically, that there's no
> guarantee that the same node will get the same UUID if stored (all other
> conditions, equal) on two different repos.
>
> Bottomline, I don't think it's a good idea to set the UUID yourself.
>
> If I may ask, which is your motivation to do so?
>
> Cheers.
>



-- 
Jason S. Tesser
Lead Programmer
www.dotmarketing.com
www.dotcms.org
Dotmarketing, Inc.
3059 Grand Avenue
Suite 440
Miami, FL 33133
T: 305.858.1422  x279
F: 786.594.5288

Re: Setting UUID

Posted by Fabián Mandelbaum <fm...@gmail.com>.
Jason Tesser escribió:
> Can I set the UUID of a node myself?  If so how?
>
>   
If I remember correctly the way JackRabbit generates the UUIDs for nodes
is "magic" and "non-deterministic" ; meaning basically, that there's no
guarantee that the same node will get the same UUID if stored (all other
conditions, equal) on two different repos.

Bottomline, I don't think it's a good idea to set the UUID yourself.

If I may ask, which is your motivation to do so?

Cheers.