[Meinds-developers] Aspects and state
Brought to you by:
emcs,
rickardoberg
|
From: Rickard <ri...@xp...> - 2001-11-29 12:58:15
|
Hey Following Dim's queries I tested how easy it would be to implement state management for the ACL. It was very very easy :-) First of all I did an ACLState interceptor. I added this to the ACLBuilder factory, so that all ACLImpl's had it "on top" of them. In invoke, before delegating the call the ACLState interceptor reads an XML file with ACL info corresponding to the resource it is attached to (e.g. "urn:user:john" will cause the file "urn/user/john/acl.xml" to be loaded). The ACLImpl was then fed these entries. The interceptor then delegated to the ACLImpl which could then perform its tasks. When the method returned the ACLState interceptor can check whether the method was a modifying one (i.e. "add") and then store the state back into the acl.xml file. All of this without having to change ACLImpl *at all*. Pretty neat. AOP rocks :-) Since I didn't have to change ACLImpl at all, I can now replace the ACLState interceptor with one that uses a database or heuristics or whatever instead, which is great. /Rickard -- Rickard Öberg |