Thanks for that Rich,

I've been playing around with this the past couple of days and have a
working model. But I'm always interested to learn the most efficient ways to
achieve these kinds of things, I'll be playing with your code for sure.

Thanks,

Rob

-----Original Message-----
From: Richard Kroll [mailto:[EMAIL PROTECTED] 
Sent: 12 April 2007 15:46
To: CF-Talk
Subject: RE: Access my SessionService from Gateway (MG, CS, Reactor)

>From your description, it seems like you are mixing layers (which will
IMO bite you later).  I would suggest keeping your components as focused
as possible.  When working on this type of problem, I create services
that manage each of the entities in the domain.  I generally separate
user authentication from authorization / entitlement.

Here is some pseudo-code to demonstrate what I'm talking about:

UserService
        - userGateway (table gateway e.g. sets of data)
        - userDAO (manage single object persistence)
        
        getUser(username,password) : UserBean ( userDAO.read(UserBean)
);
        saveUser(UserBean) : Void ( userDAO.save(UserBean) )
        getAll() : Query ( userGateway.getAll() )

UserDAO
        read(UserBean) : UserBean
        save(UserBean) : Void

UserGateway
        getAll() {
                select ... from ...
                return query;
        }

AuthenticationService
        - UserService (access to the user)
        - SessionFacade (access to the session)
        
        processLogin(username,password) : Boolean {
                user = UserService.getUser(username,password);
                return authenticateUser(user);
        }

        authenticateUser(UserBean) {
                log in user.
                if (loggedIn ) {
                        sessionFacade.setUser(UserBean);
                }
                return UserBean;
        }
EntitlementService
        - UserService
        - SessionFacade
        
        getEntitlements(UserBean)
        ...


In this type of a setup, you could create accessors
(setUserFacade/getUserFacade) for each of the composited items and let
CS inject them.

HTH,

Rich Kroll
 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:275086
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to