jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudhan <s.kan...@gmail.com>
Subject Re: [JCR Browser] Is there a way to update nt:file nodes property
Date Tue, 13 Mar 2007 22:01:36 GMT

Hello Toby,

Thanks for  your help.

Actually my application needs to store difference of file size between
version 1.1 and 1.0. Say i updated a file abc.txt by adding some 20 kb of
data. I need to see this 20 kb on version 1.1 so that I can know that how kb
difference exists between the present version and its predecessor.

presently i have a listener which listens to /jcr:system/jcr:versionStorage
node.

Is there any other way to achive above goal.

thanks,

Sudhan


Tobias Bocanegra wrote:
> 
> hi,
> i would create a new nodetype, lets say: my:Resource that extends
> nt:resource that additionally contains a property: my:fileSize. you
> can register an event listener that listens on changes on the jcr:data
> property. whenever it triggers, you can update the my:fileSize
> property and then afterwards checkin the nt:file node.
> 
> however, why do you want to store the file size explicitly when you
> can retrieve it via getProperty("jcr:data").getLength() ?
> 
> regards, toby
> 
> On 3/13/07, Sudhan <s.kanade@gmail.com> wrote:
>>
>> Hi,
>>
>> Now I have a event listener which listens for event : Node_Added
>>
>> session.getWorkspace().getObservationManager().addEventListener(
>>                                         this,
>>                                         Event.NODE_ADDED,
>>                                         "/jcr:system/jcr:versionStorage",
>> // "/",
>>                                         true,
>>                                         null,
>>                                         new String[] { "nt:base" }, //
>> parent of nt:frozenNode!
>>                                         false);
>>
>> I am dealing with only nt:file node and jcr:content is mixin:versionable.
>> So
>> whenever a new node is created I get an event with the new version say
>> 1.1
>>
>> My code further computes and finds out the file size of this updated or
>> inserted node. Also i need to set a property called as fileSize on the
>> new
>> version node (1.1). But when i try to do it by performing checkout,
>> setProperty(), save and then checkin -  i am incrementing the version
>> node
>> with 1.2 version. This i do not want to have 1.2 version as it is just a
>> update of fileSize property on version node.
>>
>> Now when i try to set a property on parent node, here it is nt:file node,
>> it
>> gives ConstraintViolationException on that node type.
>>
>> Is there any way so that i can update the property either on the version
>> node or nt:file node without actually creating  a new version or throwing
>> a
>> ConstraintViolationException.(I know nt:file does not allow setting a
>> property fileSize)
>>
>> thanks,
>>
>> Sudhan
>>
>> Paco Avila-2 wrote:
>> >
>> > El lun, 12-03-2007 a las 14:49 -0700, Sudhan escribió:
>> >> Hi,
>> >>
>> >> Is there a way to insert/update nt:file nodes property when
>> jcr:content
>> >> node
>> >> is having jcr:mixintypes as mix:versionable.
>> >>
>> >> Meaning nt:file is non versionable node and jcr:content is
>> versionable,
>> >> and
>> >> on updation of new version to jcr:content i need to compute the file
>> size
>> >> and update a property like "size" on nt:file which is non -
>> versionable
>> >> without doing checkout and checkin.
>> >
>> > I think I don't understood you. Where is the problem?
>> >
>> > --
>> > GIT Consultors S.L.
>> > c\ Francesc Rover 2-B
>> > 07003 Palma de Mallorca
>> > (Illes Balears)
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-there-a-way-to-update-nt%3Afile-nodes-property-tf3392506.html#a9460324
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-there-a-way-to-update-nt%3Afile-nodes-property-tf3392506.html#a9464385
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message