On 8/7/06 4:14 PM, Sean Davis wrote:
> This is what I thought of first, but the user of a "mirror" or "local"
> database will want to set up his/her username/password, hostname, etc.  So,
> I probably need finer, more flexible control than this; the level of the
> Rose::DB subclass seems the right level, with users just calling class
> methods before doing any object instantiation.  Is there a big downside to
> doing things this way?

Well, the downside is that you're making changes to the data source registry
that other code in the same process can see.  Maybe it's better to clone and
then modify instead of doing modify_db() directly.  IOW:

1. Get requested data source of the right type (e.g., "mirror:widgets_db")

2. Clone it and register a new user-specific variant of the data source
under an obscure name (e.g., "temp_johnsmith:mirror:widgets_db")

3. Make a new db object pointing to your newly created data source.

You can skip step 2 if you've already got a clone set up for this
datasource/user combination, and the "temp" (user-specific) data sources
disappear once the process ends.  The good thing is that the "protptype"
data sources (the ones registered in the actual .pm file) never get
modified.  This avoids any bugs where you might end up with someone else's
user/pass in your data source.

> The ideological constraint (based on history, not anything else) that I am
> trying to satisfy is basically that these modules will be used from a
> script, with no subclassing or access to the modules necessary other than
> class or object method calls.

Right.  The steps above would happen inside the modules, referencing some
external info indicating the current user and desired environment.

-John



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to