jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Login parameters
Date Mon, 29 Jul 2013 09:20:57 GMT
Hi,

It would be useful to be able to pass in extra parameters in a
Repository.login() call, in order to for example control the
auto-refresh or read-only status of the created session. Unfortunately
the standard JCR API doesn't provide any straightforward way to do
this, so I've come up with a few potential solutions:

1. Use the attribute feature of SimpleCredentials to pass such parameters:

    SimpleCredentials credentials = ...;
    credentials.setAttribute("AutoRefresh", true);
    Session session = repository.login(credentials, ...);

The downside is that it's tied to the specific Credentials class being used.

2. Use the URI query parameter syntax to pass such parameters as a
part of the workspace name:

    String workspace = ...;
    Session session = repository.login(..., workspace + "?AutoRefresh=true");

The downside is the extra complexity of parsing the workspace string
and the need to in many case look up the default workspace name
(unless we define "?..." to refer to the default workspace).

3. Extend the JackrabbitRepository interface with a new login() method
that explicitly allows such extra parameters:

    Map<String, Object> parameters =
        Collections.singletonMap("AutoRefresh", true);
    Session session = repository.login(..., parameters);

The downside is the need for the custom API extension and the
adjustments to all relevant implementations. We probably could justify
adding such a method in JCR 2.1.

4. Add a new utility class that uses a thread-local variable to pass
such extra parameters through a normal login() call:

    Map<String, Object> parameters =
        Collections.singletonMap("AutoRefresh", true);
    Session session = LoginWrapper.login(repository, ..., parameters);

The downside is the need for the custom utility class, and the extra
complexity (especially for remoting) of using thread-local variables.

WDYT?

BR,

Jukka Zitting

Mime
View raw message