You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Parvez Ahmad <pa...@gmail.com> on 2011/10/16 12:50:28 UTC

Fwd: version creation/retrieval problem

Any update on below. Is there some one who knows how to help others


---------- Forwarded message ----------
From: Parvez Ahmad <pa...@gmail.com>
Date: Tue, Sep 13, 2011 at 4:30 PM
Subject: version creation/retrieval problem
To: angela@apache.org, jira@apache.org, jukka@apache.org,
tripod@apache.org, Angela Schreiber <an...@day.com>,
dfried@phoenix-int.com, julian.reschke@gmx.de
Cc: Jürgen Baier <ju...@googlemail.com>


My best regards. I am fan of jackrabbit team and make my living by use
of your invention-- jackrabbit.

I am struggling to create version for a file from last 15 days.
Version is getting created but I am unable to retrieve the version
labels using code. I am using httpclient and am creating version for
the file using webdav.

I use jackrabit/apache sling. I want to retrieve version labels. Please help


regards
Ahmad
Srinagar Kashmir India

Sample code i use is :-
  public void createVersion(String un_encoded_virtual_Path){
        String virtualPath = Utility.encodePath(un_encoded_
virtual_Path);
        String remotePath = getServerRoot() + virtualPath;
        int status;
         try {
             VersionControlMethod vcMethod = new
VersionControlMethod(remotePath);
              executeMethod(vcMethod);
             vcMethod.releaseConnection();

             // execute check in and check out methods

             if(urlExists(remotePath)){
                 /**
                    CheckoutMethod checkOut = new CheckoutMethod(remotePath);
                    executeMethod(checkOut);
                    checkOut.releaseConnection();
                    */

                    CheckinMethod checkIn = new CheckinMethod(remotePath);
                    executeMethod(checkIn);
                    checkIn.releaseConnection();
            }


             LabelMethod lbMethod = new
LabelMethod(remotePath,"FLINTOFF", LabelInfo.TYPE_ADD);
             status  = executeMethod(lbMethod);
             System.out.println("status : " + status + "--" +
lbMethod.getResponseBodyAsString());



           } catch (Exception e2){
               e2.printStackTrace();
           }



    }
    public List<VersionVo> getVersions(String un_encoded_virtual_Path){
         List<VersionVo> lstVersions = new ArrayList<VersionVo>();
        String virtualPath = Utility.encodePath(un_encoded_virtual_Path);
        String remotePath = getServerRoot() + virtualPath;
         try {
              /// get versions
             // create the report
       /// HERE I SEE THE PROBLEM

                ReportInfo reportInfo = new
ReportInfo(ReportType.VERSION_TREE ,DavConstants.DEPTH_INFINITY);
                ReportMethod report = new ReportMethod(remotePath, reportInfo);
                client.executeMethod(report);
                MultiStatus multiStatus = report.getResponseBodyAsMultiStatus();
                MultiStatusResponse responses[] = multiStatus.getResponses();
                String responseAsString = "";
                VersionVo v;
                for(int i = 0; i < responses.length; i++) {
                    responseAsString += responses[i].getHref() + "\n";
                    v = new VersionVo();
                    v.setVersionNodePath(responses[i].getHref());
                    v.setVersionComment("version-" +i++);
                    v.setCreatedDate("hhhhh");
                    lstVersions.add(v);
                }


                report.releaseConnection();

           } catch (Exception e2){
               e2.printStackTrace();
           }
        return lstVersions;
    }

Re: version creation/retrieval problem

Posted by Jürgen Baier <ju...@googlemail.com>.
Hello Ahmad,

can you please STOP writing to the jackrabbit mailing list? We agreed
on that, or? Do not write to them, until we have discussed this
further, ok?

Please send me a reply on my mail, I want to read a statement on that. Ok?

Regards,
Jürgen


2011/10/17 Jukka Zitting <ju...@gmail.com>:
> Hi,
>
> On Sun, Oct 16, 2011 at 12:50 PM, Parvez Ahmad <pa...@gmail.com> wrote:
>> I am struggling to create version for a file from last 15 days.
>> Version is getting created but I am unable to retrieve the version
>> labels using code. I am using httpclient and am creating version for
>> the file using webdav.
>
> Why are you using the WebDAV interfaces directly instead of the
> jcr2dav wrapper that allows you to access the remote repository
> through the standard JCR API?
>
> BR,
>
> Jukka Zitting
>

Re: version creation/retrieval problem

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Sun, Oct 16, 2011 at 12:50 PM, Parvez Ahmad <pa...@gmail.com> wrote:
> I am struggling to create version for a file from last 15 days.
> Version is getting created but I am unable to retrieve the version
> labels using code. I am using httpclient and am creating version for
> the file using webdav.

Why are you using the WebDAV interfaces directly instead of the
jcr2dav wrapper that allows you to access the remote repository
through the standard JCR API?

BR,

Jukka Zitting