While debugging an issue for a client, I discovered that the 
CachedLDAPAuthorizationMap isn’t working “correctly” with blueprint and would 
like advice on how to fix it.  Basically, in Spring, the 
CachedLDAPAuthorizationMap implements the InitializingBean and DisposableBean 
interfaces so Spring will call the afterPropertiesSet method right after 
creation so it can query the LDAP server and get the ACL’s.   In blueprint, 
however, nothing calls the afterPropertiesSet method so it’s not until the 
first “update” that the ACL’s are queried so any attempt to create topics or 
anything before then would be denied.   

I can think of a few options to fix it:
1) Least potential for impact:   add a atomic boolean flag of “queried” that is 
set to false at creation, set to true on first query, and any attempt to read 
ACL’s will call the query method if it hasn’t been called before.   

2) Add @PostContruct and @PreDestroy annotations to CachedLDAPAuthorizationMap 
so blueprint will call the methods.  Not sure what spring would do if an object 
implements the interfaces AND has the annotations though.

3) Create a separate blueprint subclass and somehow get blueprint to create the 
subclass version which has the annotations on it.   Not sure how to do this 
though.


Anyway, thoughts?

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to