|
From: Brian M. <br...@ap...> - 2004-09-20 20:27:06
|
On Sep 20, 2004, at 4:01 PM, Rob Butler wrote: > Hey Brian, > > I don't know about using separate bean factories for > handling session state because usually bean factories > are for creating new (prototype) objects or dishing up > singletons, not storing objects that have been > manipulated in the application. Really, what I want are the one-per-scope "singleton" instances. The session-scoped "singleton" is a PERFECT place for sticking session state, particularly when child factories can build their prototypes from it. > I don't think bean factories will do what your looking to do. Quite possibly not, I have spent a lot more time in the pico world, but Rod has been doing a good job of trying to get me to convert ;-) > If your really set on trying this approach though you > can construct a new bean factory and then store it in > session. You can set it's parent to be the > application bean factory, and set where to read it's > config file from. That is exactly what I want. Ideally the beans could sit in the session directly and be proxied in the container, but as long as the container/factory/context is session compatible (serializable and able to rebuild dependencies intelligently after serialization (proxy proxy proxy!) this works great. > Now what's really neat about this is, I have been > trying to think of a good way to implement dynamic > configuration for a web application... and this looks > like it could fit perfectly. When your user begins a > new work flow you can "load" the configuration by > requesting a new session scoped bean factory... Which > would actually load the configuration file at that > time and retain all the setings until it was > explicitly refreshed or better yet, removed from > session and a new one loaded when the next workflow > started. =) > > Now all that is needed is to have the various spring > MVC stuff look for a session bean factory BEFORE they > look at the application bean factory. This would > allow per user configuration state to be maintained.. > which is exactly what you need for a dynamically > configurable application... Because you may need to > maintain whatever the configuration was when the user > started the current workflow.. but if their session > times out, or if they finish the workflow subsequent > operations should use the new configuration with the > updates. Exactly! -Brian |