jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Leau <costin.l...@gmail.com>
Subject decorator package enhancements
Date Wed, 07 Sep 2005 08:24:42 GMT
Hello.

I've been working lately with the decorator package existent inside
jcr-ext (contrib dir) and I've added some functionality in which you might be
interested.

1. I refactored RepositoryDecorator so that login methods variants don't call
the repository directly but they delegate everything to the 2 params
method i.e.:

    public Session login(Credentials credentials) throws LoginException,
            NoSuchWorkspaceException, RepositoryException {
        Session session = repository.login(credentials);
        return factory.getSessionDecorator(this, session); 
    }

    becomes
    
    public Session login(Credentials credentials) throws LoginException,
            NoSuchWorkspaceException, RepositoryException {
        Session session = login(credentials, null);
        return factory.getSessionDecorator(this, session); 
    }
    
This minor change makes any subclass of RepositoryDecorator to extend
only 1 method not the whole 3 variants of login.


2. I've added two DecoratorFactories for chaining decorators.

a. One simply does delegation to the next one in chain, allowing the
decorator to call the next one in line or skip it.

b. the second one always considers also the top of the chain. This is
useful if the decorator diverts the method call. For example the login
on the repositoryDecorator diverts the call to getSessionDecorator
(the Session decorator).
Inside a chain, this may lead to undesired effects because the
decorators before the current level inside the chain are not called
(in this example the decorators for the session).

On top of these classes I've added two decoratoring factories which
register session listeners (JackRabbit specific) and event listeners
inside the workflow in a transparent way.

What would be the procedure to review my code and maybe add this code to the JackRabbit
procedure?

-- 
Best regards,
 Costin Leau                         mailto:costin.leau@gmail.com


Mime
View raw message