Hey all,

I have a MG application in development and i'm considering a bit of a
refactor. Here's the core components

*ProductWebService a wrapper class for the webservice, gets passed a
username & password in init() and then performs a login() call to the
webservice to retrieve a cookie used to authenticate subsequent calls.  *

*ProductManager gets an instance of ProductWebService, Handles all the
business logic involved with using the web service*

*ModelGlue Controllers get passed ProductManager into their beans scope*

So the application was originally spec'd to have an installation per client,
but we're thinking about changing to have one installation, then use MG's
dynamic view mappings to customize the UI for each client.  What i'm
wondering is how to refactor  things to allow the ProductWebService &
ProductManager to allow different username/password for each customer.

I can't treat ProductWebService as a transient because the login() call
that's required when its created is a big overhead. So i'm thinking about
creating a ProductWebServiceFactory to create and cache instances of the
ProductWebService, then making the ProductManager a per-request object
created in onRequestStart and injected with the
appropriate ProductWebService for the current request and placed in the
event.

If anyone has any thoughts on this approach, or have any suggestions on how
it might be improved, would be muchly appreciated.

Cheers, Chris

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to