On Fri, 9 Nov 2001, Marcus Crafter wrote: My answer to this question is the Context object. Of course you have to set it in the main class where you create and configure your CM and have the information you need to put into the Context from somewhere else that the component xconf file. But I see the Context object as the entity responsable for holding "global" information. Components interested in this information must implement the Contextualizable interface.
Giacomo > Hi All, > > Hope all is well! > > Sorry for asking such a simple question, but I'm kinda stuck, > and I'd like to learn how to use avalon the way it was intended :) > > Pretty simple question, hence the title - I'm wondering how others > access global configuration settings specified in xml files, when > configuring managed components. > > I have a few settings like 'default operating mode', 'default > server locale', 'default unavailable time' etc, which are not > really applicable to any one component in my app, but are global > across the entire application and commonly required by several > components - I'm wondering where I should specify them in our .xconf > config file, and how I should access them in my application. > > Using the component manager described in Berin's document I can easily > create a config file for all my components and have them automatically > configured which is really cool - but how should I obtain > non-per-component specific options ? > > Should I create a 'globals' component or similar so that I have > something like: > > <app> > <globals> > <operating-mode>test</operating-mode> > <unavailable-time>100</unavailable-time> > <server-locale>en_AU</server-locale> > </globals> > </app> > > and so on ? I can see how this would work - but is this overkill ? > (ie. creating a whole new component simply just to store some values). > > Something like: > > <app mode="test"> > <unavailable-time>100</unavailable-time> > <server-locale>de_DE</server_locale> > </app> > > would be possible if I handled everything manually, but I can't see > how I can access these values from a managed component - The > Configuration object passed via configure() Component is not the > complete file, just what's under it's component definition. > > Perhaps I should save the values somewhere before calling > ComponentManager.configure() ? > > Any thoughts ? Ideas ? Obviously I'm still learning :) > > Cheers, > > Marcus > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>