uPortal IRC Logs-2009-01-23

[03:50:31 EST(-0500)] * higmad (n=chatzill@pcit-8752.HIG.SE) has joined ##uportal
[03:58:45 EST(-0500)] * higmad (n=chatzill@pcit-8752.HIG.SE) has joined ##uportal
[03:58:45 EST(-0500)] * athena7 (n=athena7@adsl-99-136-251-32.dsl.wlfrct.sbcglobal.net) has joined ##uportal
[09:15:33 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[09:26:32 EST(-0500)] * EricDalquist (n=dalquist@bohemia.doit.wisc.edu) has joined ##uportal
[09:32:27 EST(-0500)] <athena7> morning EricDalquist
[09:33:20 EST(-0500)] <athena7> had a couple of uportal-y things to discuss, if you have time at some point
[09:44:45 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[09:59:25 EST(-0500)] * michelled (n=team@142.150.154.197) has joined ##uportal
[10:03:36 EST(-0500)] * apetro (n=apetro@ip68-3-207-51.ph.ph.cox.net) has joined ##uportal
[10:11:00 EST(-0500)] * colinclark (n=colin@bas2-toronto09-1176131408.dsl.bell.ca) has joined ##uportal
[10:44:39 EST(-0500)] * lennard1 (n=sparhk@uni1.unicon.net) has joined ##uportal
[10:56:02 EST(-0500)] * apetro (n=apetro@12.164.139.7) has joined ##uportal
[10:56:26 EST(-0500)] * apetro_ (n=apetro@12.164.139.7) has joined ##uportal
[11:12:37 EST(-0500)] * awills (n=awills@wsip-98-174-242-39.ph.ph.cox.net) has joined ##uportal
[11:13:11 EST(-0500)] <awills> EricDalquist can you point to a succinct description of what <aop:scoped-proxy /> does?
[11:13:52 EST(-0500)] <awills> does it somehow connect with OverwritingPersonAttributeDao.attributeOverridesMap?
[11:16:28 EST(-0500)] <athena7> i'm not sure if he's actually around
[11:16:53 EST(-0500)] <awills> anyone else know what that thing does? (smile)
[11:19:31 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[11:20:29 EST(-0500)] <athena7> no, sorry!
[11:21:06 EST(-0500)] <awills> lol
[11:21:10 EST(-0500)] <athena7> best i can do is wildly gesticulate at the spring docs
[11:21:21 EST(-0500)] <athena7> which i'm assuming you could do without my help (smile)
[11:21:42 EST(-0500)] <awills> yeah i'm looking (wink)
[11:22:04 EST(-0500)] <athena7> yeah i figured, lol
[11:22:25 EST(-0500)] <EricDalquist> hey
[11:22:27 EST(-0500)] <EricDalquist> meetings
[11:22:29 EST(-0500)] <EricDalquist> just got back
[11:22:34 EST(-0500)] <athena7> welcome back!
[11:22:37 EST(-0500)] <athena7> we all missed you terribly
[11:23:13 EST(-0500)] <EricDalquist> aop:scoped-proxy tells the spring app context that it needs to generate an AOP proxy around the bean to handle scope lookups
[11:23:38 EST(-0500)] <EricDalquist> http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes-other-injection
[11:24:10 EST(-0500)] <EricDalquist> lets see if I can write up an example to better explain
[11:24:19 EST(-0500)] <awills> i thinkk i follow you...
[11:24:42 EST(-0500)] <awills> i was surprised to see this: attributeOverridesMap = new ConcurrentHashMap<String, Map<String,List<Object>>>();
[11:25:03 EST(-0500)] <awills> looks like the OverwritingPersonAttributeDao maintains Maps for multiple users
[11:25:21 EST(-0500)] <awills> but i would have expected it to be one OverwritingPersonAttributeDao / user
[11:25:35 EST(-0500)] <EricDalquist> let me go look at the code ....
[11:28:50 EST(-0500)] <EricDalquist> ah so the Map is keyed on UID for a very good reason
[11:28:57 EST(-0500)] <EricDalquist> what if I have one of my attributes overridden
[11:29:00 EST(-0500)] <EricDalquist> stored in a session scoped map
[11:29:07 EST(-0500)] <EricDalquist> then I look up user attributes for you?
[11:29:24 EST(-0500)] <EricDalquist> it needs to make sure it is only overriding my attributes, not yours to when I look them up
[11:31:06 EST(-0500)] <awills> ah, ok
[11:31:57 EST(-0500)] <awills> but there is one instance of that thing / httpsession... and spring just magically makes sure you get the right one when person attributes are queried?
[11:32:18 EST(-0500)] <EricDalquist> yeah ... just one sec ... someone just walked in
[11:33:36 EST(-0500)] <EricDalquist> yeah, so injecting the following:
[11:33:36 EST(-0500)] <EricDalquist> <bean id="sessionAttributesOverridesMap" class="java.util.concurrent.ConcurrentHashMap" scope="globalSession">
[11:33:36 EST(-0500)] <EricDalquist> <aop:scoped-proxy />
[11:33:36 EST(-0500)] <EricDalquist> </bean>
[11:33:48 EST(-0500)] <EricDalquist> results in an AOP proxy of a Map interface
[11:34:04 EST(-0500)] <EricDalquist> that then uses the Spring request context holder APIs to get the current Session
[11:34:21 EST(-0500)] <EricDalquist> and then get an attribute from that session for the bean to use
[11:34:45 EST(-0500)] <EricDalquist> if you look in applicationContext.xml line 52
[11:34:55 EST(-0500)] <EricDalquist> you can see where we register a custom scope handler for globalSession
[11:35:16 EST(-0500)] <EricDalquist> this adds two things to the default functionality
[11:36:05 EST(-0500)] <EricDalquist> 1 is failover, the default Spring globalSession will throw an exception if no session is available for the current request, our failover handler keeps a 'fallback' object to use in the case of no session
[11:36:59 EST(-0500)] <EricDalquist> 2 we have a PortalSessionScope which understands the work involved with unwrapping requests down to the base portal request since there are times when the current request may be a request for some portlet during portlet rendering
[11:37:33 EST(-0500)] <awills> ah, so i represented it not quite correctly... it's not the whole DAO that's instantiated 1 / user... it's the 'attributeOverridesMap' property of OverwritingPersonAttributeDao
[11:37:42 EST(-0500)] <EricDalquist> correct
[11:37:59 EST(-0500)] <EricDalquist> OverwritingPersonAttributeDao has default scope
[11:38:04 EST(-0500)] <EricDalquist> which means it is just a singleton
[11:38:17 EST(-0500)] <EricDalquist> the sessionAttributesOverridesMap bean is what is placed in the session scope
[11:38:28 EST(-0500)] <awills> gotcha, gotcha
[11:38:49 EST(-0500)] <EricDalquist> and the <aop:scoped-proxy /> tag adds the dynamic proxy wrapper so that Scope.get() is called each time it is referenced instead of just once when the app context is started up
[11:39:00 EST(-0500)] <awills> so does the container call setAttributeOverridesMap() frequently then?
[11:39:12 EST(-0500)] <EricDalquist> no
[11:39:25 EST(-0500)] <EricDalquist> setAttributeOverridesMap is called once when the container is started
[11:39:37 EST(-0500)] <EricDalquist> but instead of a ConcurrentHashMap being injected
[11:39:48 EST(-0500)] <awills> i follow... the object that's passed to that method in the beginning hides that complexity
[11:39:49 EST(-0500)] <EricDalquist> a dynamic proxy of the Map interface is injected
[11:40:13 EST(-0500)] <EricDalquist> that dynamic proxy has a reference to a Scope object that knows how to get or create the real object
[11:40:18 EST(-0500)] <awills> ok... so that brings me to my next question...
[11:40:38 EST(-0500)] <EricDalquist> whenever an method is called on the proxy it looks up the right object to use via calling Scope.get
[11:40:43 EST(-0500)] <awills> how to I tap into this system from the J2EE API?
[11:41:05 EST(-0500)] <EricDalquist> http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/factory/config/Scope.html
[11:41:12 EST(-0500)] <EricDalquist> ?
[11:41:16 EST(-0500)] <EricDalquist> what J2EE API?
[11:41:21 EST(-0500)] <awills> i want to make a DAO like yours, but I need to set the value from a J2EE servlet filter
[11:41:48 EST(-0500)] <EricDalquist> did you see the change I made to a filter you added recently?
[11:42:00 EST(-0500)] <awills> probably not
[11:42:12 EST(-0500)] <EricDalquist> are you in trunk right now?
[11:42:16 EST(-0500)] <awills> yep
[11:42:52 EST(-0500)] <EricDalquist> ok .. let me find the file to point you to ....
[11:43:22 EST(-0500)] <awills> maxInactiveFilter?
[11:44:00 EST(-0500)] <EricDalquist> yes
[11:44:16 EST(-0500)] <EricDalquist> see that I changed it to a Spring DelegatingFilterProxy
[11:44:35 EST(-0500)] <EricDalquist> crap eclipse just crashed ...
[11:45:06 EST(-0500)] <EricDalquist> so there is a spring bean with the same name that implements the servlet filter API just like any other filter
[11:45:20 EST(-0500)] <EricDalquist> and the spring delegating filter just applies that
[11:45:46 EST(-0500)] <EricDalquist> uPortal_trunk/uportal-impl/src/main/resources/properties/contexts/securityContext.xml
[11:46:00 EST(-0500)] <EricDalquist> the advantage to this approach is it allows you to use DI in your filter
[11:49:03 EST(-0500)] <EricDalquist> back in a few minutes ....
[11:58:50 EST(-0500)] <EricDalquist> find that example ok?
[12:01:35 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[14:06:59 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[15:26:37 EST(-0500)] * dstn (n=dstn@unaffiliated/dstn) has joined ##uportal
[18:13:12 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[19:01:09 EST(-0500)] * bszabo (n=bszabo@ip72-208-41-138.ph.ph.cox.net) has joined ##uportal
[19:01:35 EST(-0500)] * lennard1 (n=sparhk@uni1.unicon.net) has joined ##uportal
[19:05:56 EST(-0500)] * awills (n=awills@wsip-98-174-242-39.ph.ph.cox.net) has left ##uportal