You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Outta Sight <ou...@ymail.com> on 2008/08/12 19:34:23 UTC

Scripts for Basic Versioning

I'm looking for an example of how to perform versioned POSTs (POST.esp) and also how to access a list of these versions (versions.esp) for any node. It seems that this sort of capability must be scripted using Sling scripts. Does anybody have examples using Javascript? Because Sling is built on top of a content repository where one of the primary features is versioning - I'd like to know how to do this.

Outta


      


Re: Scripts for Basic Versioning

Posted by Michael Marth <mm...@day.com>.
Outta,

just saw only now that you've already referred to that post on this list.
There is also a bit of .esp sample code here[1] - not quite what you are
looking for, but maybe enough to get you started (have a look in apps.zip -
mailingLists/query)

Michael

[1] http://dev.day.com/microsling/content/blogs/main/littleapp.html

On Wed, Aug 13, 2008 at 1:53 PM, Michael Marth <mm...@day.com> wrote:

> Here's an example script[1] for a POST that creates versions - a JSP,
> though. (have a look in the attached zip file)
>
> Michael
>
> [1] http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html
>
> On Tue, Aug 12, 2008 at 7:34 PM, Outta Sight <ou...@ymail.com> wrote:
>
>> I'm looking for an example of how to perform versioned POSTs (POST.esp)
>> and also how to access a list of these versions (versions.esp) for any node.
>> It seems that this sort of capability must be scripted using Sling scripts.
>> Does anybody have examples using Javascript? Because Sling is built on top
>> of a content repository where one of the primary features is versioning -
>> I'd like to know how to do this.
>>
>> Outta
>>
>>
>>
>>
>>
>
>
> --
> Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/
>



-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/

Re: Scripts for Basic Versioning

Posted by Michael Marth <mm...@day.com>.
Here's an example script[1] for a POST that creates versions - a JSP,
though. (have a look in the attached zip file)

Michael

[1] http://dev.day.com/microsling/content/blogs/main/anothersampleapp.html

On Tue, Aug 12, 2008 at 7:34 PM, Outta Sight <ou...@ymail.com> wrote:

> I'm looking for an example of how to perform versioned POSTs (POST.esp) and
> also how to access a list of these versions (versions.esp) for any node. It
> seems that this sort of capability must be scripted using Sling scripts.
> Does anybody have examples using Javascript? Because Sling is built on top
> of a content repository where one of the primary features is versioning -
> I'd like to know how to do this.
>
> Outta
>
>
>
>
>


-- 
Michael Marth | Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/

Re: Scripts for Basic Versioning

Posted by Tobias Bocanegra <to...@day.com>.
On 8/13/08, Felix Meschberger <fm...@gmail.com> wrote:
> Hi Outta,
>
>  Outta Sight schrieb:
>
> > I'm looking for an example of how to perform versioned POSTs (POST.esp)
> and also how to access a list of these versions (versions.esp) for any node.
> It seems that this sort of capability must be scripted using Sling scripts.
> Does anybody have examples using Javascript? Because Sling is built on top
> of a content repository where one of the primary features is versioning -
> I'd like to know how to do this.
you can use the JSP api directly in the script, so eg. node.checkin()
should work.

>  Currently the SlingPostServlet does not do versioning. This would be an
> extension to be built in.
>
>  Regarding versioning there are probably two use cases:
>
>   * checkpointing - create a new version of the modified node
>         before modifying it
>   * versioning - create a new version of the modified node
>         after modifying it
>
>  In addition, I think, the SlingPostServlet should automatically check out a
> versionable node before modification if the nodes happens to be checked in.
this is not always desired. for example if a node is checked in, it
could also mean that it should not to be altered until explicitly
checked-out.

>  It also needs to be discussed, whether the node remains checked out after
> the operation or is checked in. Probably, it should be in the state it was
> before the operation: If the node was checked in, it must be checked in
> after the operation. If it was checked out, it must be checked out after the
> operation.
i think that the versioning operations: checkin, checkout, checkpoint,
restore need separate operations with clear additional parameters. i
think too much magic in this case is not desirable.

>  Regarding access to the versions: There are two cases again:
>
>   * Access to a certain (known) version
>   * Listing all versions of a node
>
>  The first case might be implemented by the resource resolver as noted in
> another thread by supporting parametrized URLs of the form
> http://host/path;v=1.
in the case you have an entire site versioned this is not very
practical, since the names of the versions of each node are different.
what you probably want is some sort of time-based version selector,
eg:  http://host/path;vdate=2008-08-13T08:11:00
which selects the most recent version before that date. a rewriter
could adjust all links to resources and other pages so that the entire
site is 'put' into an old state.

>
>  The second case could be handled by the JSON default get servlet, which
> could be enhanced to return a list of the versions for a given node...
i would issue a second request to the version history of that
node....this provides much more information.

regards, toby

Re: Scripts for Basic Versioning

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Outta,

Outta Sight schrieb:
> I'm looking for an example of how to perform versioned POSTs (POST.esp) and also how to access a list of these versions (versions.esp) for any node. It seems that this sort of capability must be scripted using Sling scripts. Does anybody have examples using Javascript? Because Sling is built on top of a content repository where one of the primary features is versioning - I'd like to know how to do this.

Currently the SlingPostServlet does not do versioning. This would be an 
extension to be built in.

Regarding versioning there are probably two use cases:

   * checkpointing - create a new version of the modified node
         before modifying it
   * versioning - create a new version of the modified node
         after modifying it

In addition, I think, the SlingPostServlet should automatically check 
out a versionable node before modification if the nodes happens to be 
checked in.

It also needs to be discussed, whether the node remains checked out 
after the operation or is checked in. Probably, it should be in the 
state it was before the operation: If the node was checked in, it must 
be checked in after the operation. If it was checked out, it must be 
checked out after the operation.


Regarding access to the versions: There are two cases again:

   * Access to a certain (known) version
   * Listing all versions of a node

The first case might be implemented by the resource resolver as noted in 
another thread by supporting parametrized URLs of the form 
http://host/path;v=1.

The second case could be handled by the JSON default get servlet, which 
could be enhanced to return a list of the versions for a given node...


Regards
Felix