Something like the following:

        Configuration c =
configuration.subset("database").subset("adapter");
        Iterator i = c.getKeys();
        while (i.hasNext())
        {
            String key = (String)i.next();                
            String adapter = c.getString(key);
            DB db = DBFactory.create( adapter );
            // register the adapter for this name
            adapterMap.put(key, db);
        }

This code does not care, if the Configuration is reading a properties
file or an xml file.

john mcnally



Jason van Zyl wrote:
> 
> On Sat, 2002-03-23 at 00:08, John McNally wrote:
> > Jason van Zyl wrote:
> > >
> > > On Fri, 2002-03-22 at 18:57, John McNally wrote:
> > > > Please send a patch to get your driver included in DBFactory.  There is
> > > > not much reason to recode to the old style.  Soon torque will use any
> > > > connection pool and the adapter will be specified in the properties
> > > > file.  Similar to the old way, but there will be no tie between the
> > > > adapter and the driver (if a driver is even used.)
> > >
> > > Can we please use an XML configuration if we're going to change
> > > anything. I think XML configurations lend themselves to manipulation in
> > > an UI much more easily and they can be verified with an XML Scheme or
> > > XML DTD.
> > >
> >
> > I thought the point of switching to the Configuration interface was to
> > allow the xml option.  There is no reason this needs to be different
> > than the other parameters.
> 
> I'm not sure I understand the argument here. Are you saying you want to
> use a properties file? And why bother with XML? I'm just making sure I
> understand before I respond.
> 
> > john mcnally
> >
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> --
> jvz.
> 
> Jason van Zyl
> [EMAIL PROTECTED]
> 
> http://tambora.zenplex.org
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to