You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Davide Maestroni <da...@gmail.com> on 2010/05/26 16:47:24 UTC

Export DataStore

Hi all,

I would like to know the best way to export the files stored on the file
system, using the "org.apache.jackrabbit.core.data.FileDataStore" data store
implementation, to a web site.
Let me explain my problem in details. I have a Jackrabbit repository storing
a lot of image files, and I need to publish such images to a web site. In
order to avoid the overhead of querying each time the repository to get the
correct file, I tried the following solution: I copied the whole directory
used by the FileDataStore to another directory on my server, using rsync to
keep the two synchronized. Then the idea was to serve the files to the
clients by setting the "Expires" header to the maximum time allowed in the
future (sort of "forever"). In this way I could take advantage of the
garbage collection mechanism already implemented in the data store, so that
one file would have immediately expired as soon as it was no more available
in the data store directory, i.e. as soon as its content would have changed.
And here is my issue: I couldn't find a way to map the original file name to
the one generated by the FileDataStore.
Can anybody suggest me a way to do that? Or maybe I am just on the wrong way
and you can suggest me a better approach for publishing the images...

Thanks in advance,

Davide

Re: Export DataStore

Posted by Rakesh Vidyadharan <ra...@sptci.com>.
On 26 May 2010, at 09:47, Davide Maestroni wrote:

> Hi all,
> 
> I would like to know the best way to export the files stored on the file
> system, using the "org.apache.jackrabbit.core.data.FileDataStore" data store
> implementation, to a web site.
> Let me explain my problem in details. I have a Jackrabbit repository storing
> a lot of image files, and I need to publish such images to a web site. In
> order to avoid the overhead of querying each time the repository to get the
> correct file, I tried the following solution: I copied the whole directory
> used by the FileDataStore to another directory on my server, using rsync to
> keep the two synchronized. Then the idea was to serve the files to the
> clients by setting the "Expires" header to the maximum time allowed in the
> future (sort of "forever"). In this way I could take advantage of the
> garbage collection mechanism already implemented in the data store, so that
> one file would have immediately expired as soon as it was no more available
> in the data store directory, i.e. as soon as its content would have changed.
> And here is my issue: I couldn't find a way to map the original file name to
> the one generated by the FileDataStore.
> Can anybody suggest me a way to do that? Or maybe I am just on the wrong way
> and you can suggest me a better approach for publishing the images...
> 
> Thanks in advance,
> 
> Davide

A caching tier on top of the repository (ehcache or similar) would be easier IMHO.  The cache takes care of keeping a cache file of the contents that are to be repeatedly served out, and you have various configuration parameters to control cache expiry etc.  A simple caching servlet filter will work just as well (I used the latter approach to serve out large XML files for a REST webservice years ago).

Rakesh