[ 
http://issues.apache.org/jira/browse/JCR-212?page=comments#action_12322971 ] 

Costin Leau commented on JCR-212:
---------------------------------

FullChainedDecorator makes sense when you have more decorators.  A decorator 
contains a level of decorators (a repository decorator, a session, workspace 
and so on) and through the factory, the calls are made between components of 
the same level (same factory) - a repository login for example will return 
session decorator through it's factory.
When one uses multiple decorators factories (which most of the times are 
unaware of each others) you need a way to make sure the decorators before the 
current 'level' are executed (as the chain implementation only delegates to the 
factories which are after the current level).

Through FullChainedDecoratorFactory you have the topOfChain member (or utility 
methods) which can guarantee that the full chain will be used for the 
decoration of the new element returned.
Example:
Consider factory A which decorates the only some session methods (like 
getLockMethods) and factory B which decorates the repository and the session 
returned by login. If you are using the normal
chained factory the call to the repository is not decorated by factory A hits 
factory B, which decorated the login for example and return the decorated 
session from A but without the decorated session from A. By using the full 
chained factory, inside the decorated repository A on login method 
chainedFactory.getSessionDecorator can be removed with
topOfChain.getSessionDecorator - which will use all session decorators inside 
the chain (including A).
It's the difference between using the session decorators from this point on and 
apply all the decorators on this chain.

An alternative would be at level A to create a repository decorator which 
overrides login method to make sure it will apply the session decorator.

I implemented this factory because Session, Repository, Workspaces are related 
to each other but I wanted to create decorators only for the components I'm 
interested in not also in the ones that returned them (maybe I was/am confused 
by the 'calling' points to the JCR entities - (for example to a session can be 
obtain by Session.impersonate or by Repository.login).

> decorator enhancements
> ----------------------
>
>          Key: JCR-212
>          URL: http://issues.apache.org/jira/browse/JCR-212
>      Project: Jackrabbit
>         Type: Improvement
>     Reporter: Costin Leau
>     Assignee: Jukka Zitting
>  Attachments: decorators.zip
>
> added some decorating enhancements as we discussed on the mailing list 
> (apparently there is nothing yet in the gmane /marc archives).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to