Can't get an excerpt when using JCR Webdav I/F

View: New views
4 Messages — Rating Filter:   Alert me  

Can't get an excerpt when using JCR Webdav I/F

by Julio Castillo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a client accessing a server running jackrabbit.

I access the client via a custom client using the JCR 2 SPI interfaces.

I have been successful at storing, retrieving, searching documents.

I have not been able to get excerpts from the documents returned. I modeled
my logic after the search.jsp that ships with the jackrabbit war file.

Below is an excerpt (no pun intended) of my code.

    while (rowIt.hasNext()) {
        row = rowIt.nextRow();
        fileNode =
(Node)session.getItem(row.getValue("jcr:path").getString());
        rsrcNode = fileNode.getNode("jcr:content");
        if (rsrcNode.hasProperty("jcr:data"))
            fileSize = rsrcNode.getProperty("jcr:data").getLength();
        lastModified = rsrcNode.getProperty("jcr:lastModified").getDate();
        System.out.println (
                "File:"+ fileNode.getName() + "  [" + fileSize + "] " +
                lastModified.getTime());
       
System.out.println(row.getValue("rep:excerpt(jcr:content)").getString());
    }

While attempting to execute last getValue call I get the following error:
javax.jcr.RepositoryException: ':' not allowed in name

If I just use getValue("rep:excerpt()") I get an xml output that provides no
value to me: <excerpt><fragment></fragment></excerpt>

I think this is just different behavior between running this within
jackrabbit and remotely via JCR/SPI.

Any ideas?

Julio Castillo
Edgenuity Inc.


Re: Can't get an excerpt when using JCR Webdav I/F

by Marcel Reutegger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Julio,

the rep:excerpt() function is jackrabbit-core specific and is not guaranteed to
work across the more JCR generic SPI layer.

regards
  marcel

Julio Castillo wrote:

> I have a client accessing a server running jackrabbit.
>
> I access the client via a custom client using the JCR 2 SPI interfaces.
>
> I have been successful at storing, retrieving, searching documents.
>
> I have not been able to get excerpts from the documents returned. I modeled
> my logic after the search.jsp that ships with the jackrabbit war file.
>
> Below is an excerpt (no pun intended) of my code.
>
>     while (rowIt.hasNext()) {
> row = rowIt.nextRow();
> fileNode =
> (Node)session.getItem(row.getValue("jcr:path").getString());
> rsrcNode = fileNode.getNode("jcr:content");
> if (rsrcNode.hasProperty("jcr:data"))
>    fileSize = rsrcNode.getProperty("jcr:data").getLength();
> lastModified = rsrcNode.getProperty("jcr:lastModified").getDate();
> System.out.println (
> "File:"+ fileNode.getName() + "  [" + fileSize + "] " +
> lastModified.getTime());
>
> System.out.println(row.getValue("rep:excerpt(jcr:content)").getString());
>     }
>
> While attempting to execute last getValue call I get the following error:
> javax.jcr.RepositoryException: ':' not allowed in name
>
> If I just use getValue("rep:excerpt()") I get an xml output that provides no
> value to me: <excerpt><fragment></fragment></excerpt>
>
> I think this is just different behavior between running this within
> jackrabbit and remotely via JCR/SPI.
>
> Any ideas?
>
> Julio Castillo
> Edgenuity Inc.
>
>


RE: Can't get an excerpt when using JCR Webdav I/F

by Julio Castillo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 I guess this then merits a JIRA feature request when done across JCR/SPI
i/f.

Question in general regarding architectures. I understand that SPI is going
through its growing pains, but what is the recommended model when I have a
farm of application servers that want to use Jackrabbit? My thoughts were to
use JCR Webdav/SPI to access a server running the Jackrabbit service from
any of the app servers internally.

If this is not yet mature enough, I will have to bundle jackrabbit with each
app server sharing a single dB repository with the obvious risk of stepping
on each other.

Suggestions?

** julio

-----Original Message-----
From: Marcel Reutegger [mailto:marcel.reutegger@...]
Sent: Friday, May 09, 2008 5:59 AM
To: users@...
Subject: Re: Can't get an excerpt when using JCR Webdav I/F

Hi Julio,

the rep:excerpt() function is jackrabbit-core specific and is not guaranteed
to work across the more JCR generic SPI layer.

regards
  marcel

Julio Castillo wrote:
> I have a client accessing a server running jackrabbit.
>
> I access the client via a custom client using the JCR 2 SPI interfaces.
>
> I have been successful at storing, retrieving, searching documents.
>
> I have not been able to get excerpts from the documents returned. I
> modeled my logic after the search.jsp that ships with the jackrabbit war
file.

>
> Below is an excerpt (no pun intended) of my code.
>
>     while (rowIt.hasNext()) {
> row = rowIt.nextRow();
> fileNode =
> (Node)session.getItem(row.getValue("jcr:path").getString());
> rsrcNode = fileNode.getNode("jcr:content");
> if (rsrcNode.hasProperty("jcr:data"))
>    fileSize = rsrcNode.getProperty("jcr:data").getLength();
> lastModified = rsrcNode.getProperty("jcr:lastModified").getDate();
> System.out.println (
> "File:"+ fileNode.getName() + "  [" + fileSize + "] " +
> lastModified.getTime());
>
> System.out.println(row.getValue("rep:excerpt(jcr:content)").getString());
>     }
>
> While attempting to execute last getValue call I get the following error:
> javax.jcr.RepositoryException: ':' not allowed in name
>
> If I just use getValue("rep:excerpt()") I get an xml output that
> provides no value to me: <excerpt><fragment></fragment></excerpt>
>
> I think this is just different behavior between running this within
> jackrabbit and remotely via JCR/SPI.
>
> Any ideas?
>
> Julio Castillo
> Edgenuity Inc.
>
>


Re: Can't get an excerpt when using JCR Webdav I/F

by Marcel Reutegger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Julio Castillo wrote:
> Question in general regarding architectures. I understand that SPI is going
> through its growing pains, but what is the recommended model when I have a
> farm of application servers that want to use Jackrabbit? My thoughts were to
> use JCR Webdav/SPI to access a server running the Jackrabbit service from
> any of the app servers internally.

that's one possible architecture. you may also consider the following:

1) jcr2spi<->spi-rmi<->spi2jcr<->jackrabbit-core
2) jcr-rmi<->jackrabbit-core

1) as well as the webdav/spi stack you mentioned are not yet optimized for
performance. we are currently in the process of analyzing message complexity of
spi calls and finding ways how to minimize them.

2) jcr-rmi is quite mature but does not come with sophisticated client-side
caches. it works well with applications that do not require high performance.

> If this is not yet mature enough, I will have to bundle jackrabbit with each
> app server sharing a single dB repository with the obvious risk of stepping
> on each other.

I assume you are referring to clustering. yes, that's another alternative.

regards
  marcel