On Apr 25, 2011, at 4:30 AM, Steve Ebersole wrote:
Just to circle back to this (because my memory is so short)..
What did we ever decide about this, especially in regards to the *how*?
As and example, lets look at Search. Search wraps Session in a FullTextSession. Search
would register some handler with the SessionFactory that says it knows how to handle
Session.as( FullTextSession.class ) calls. But what exactly is this handler going to do?
Unless Search maintains some global Session instance -> FullTextSession instance... Or
are you thinking the registration happens per-Session?
I would imagine that Search's Integrator registers some .as(FTS.class)-handler in the
SessionFactory.
Then if Session.as(FTS.class) is invoked, on the first time it delegates to the handler,
which creates the FTS and this is returned to the caller.
On the second time the session returns the already created FTS (so there would be a
per-session cache of the created wrappers inside the Session).
Adam
--
Adam Warski
http://www.warski.org
http://www.softwaremill.eu