Dave Ross wrote:
On 11/19/05, Peter J. Farrell <[EMAIL PROTECTED]> wrote:
  
 Also, can't wait to play with the AOP stuff.  I'm expect to be working on a
project that will require logging who accesses certain data in the database
-- sounds like I could create a logging service to check who's looking at
what.  Is that correct?  (My knowledge of AOP is limited to the blog posts
by Chris Scott and Wikipedia).
    

Create a LoggingService because you need to do logging, but it won't
have anything to do with AOP (chances are you'll have an area of your
app where you'll do "traditional logging" meaning the LoggingService
is injected into one of you model components and is used to "log
stuff"). The LoggingService is part of your model.

Then you would create a LoggingAspect, and inject your logging service
into the LoggingAspect just as you did into other model components.
The Aspect is called by the AOP framework when the "pointcuts" occur
(e.g. before this method, after this method, etc), and the Aspect will
use the LoggingService to log what happened. I think Sean is going to
blog about Aspects and where they fit in your model, and what I just
described is what I consider "best practice", meaning that, when
possible, your Aspects use your Model components to get their jobs
done, and don't contain much business logic themselves (this isn't a
100% rule... it really depends on what you are gonna use AOP for).
  
Thanks...sorta what I thought, but didn't explain that very well in my original message.  Now I understand that the logging service is part of my model and the logging aspect sorta "glues" the service into the AOP framework.  So I could implement the "before" pointcut in the aspect cfc to log query parameters for certain DAO, which would call a method in my logging service which will log that information as well as the user that called it (probably by getting the user name from a session facade...which of course was injected into the service).  A  lot going on here - just trying to get a "roadmap" in my head.  I read Chris's blog entries on this -- need to pour over them again.

Thanks again Dave!

.Peter
-- 
Peter J. Farrell :: Maestro Publishing
http://blog.maestropublishing.com

Rooibos Generator - Version 2.1
Create boilerplate beans and transfer objects for ColdFusion for free!
http://rooibos.maestropublishing.com/

Member Team Mach-II

Reply via email to