abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Abley" <james.ab...@gmail.com>
Subject request lifecycle for setting up and tearing down
Date Fri, 01 Aug 2008 09:44:40 GMT
Hi,

I'm trying to understand the idiomatic way to set up and teardown
resources during request processing.

In my case, I need a JCR session to store / retrieve data in the
underlying repository. I need to get an session from my session pool,
and then return my session to the session pool.

1. Use an Abdera Filter. This works for managing entries and media,
but fails for the service document. The session gets destroyed before
the output is created and an exception is thrown.

2. Use Transactional start / end, as per the example JCR Adapter in
the Abdera code. This works for managing entries and media, but fails
for the service document. start() is never called to create a session
for the request. The JcrCollectionAdapter sample within Abdera does
not suffer from this, since it only has a single workspace which is
programmatically configured with SimpleWorkspaceInfo

SimpleWorkspaceInfo wkspc = new SimpleWorkspaceInfo();
    wkspc.setTitle("JCR Workspace");
    wkspc.addCollection(cp);
    jcrProvider.addWorkspace(wkspc);

I need to be able to connect using a JCR session and enumerate the
available workspaces.

3. Use a Servlet Filter. This works, but duplicates some of the URI
parsing that Abdera does for me. If I manage JCR sessions within the
Abdera framework, I get to use the Target and parameters from the URI
path to determine which JCR workspace the request is for.

4. Use an Abdera filter to create the JCR session, and a Servlet
Filter to tear down the JCR session. This seems the best solution that
I have so far, but feels messy in terms of the asymmetry.

Does anyone have any suggestions as to what I'm missing?

Cheers,

James

Mime
View raw message