obix-framework-tipsandtricks Mailing List for The Obix Framework
Brought to you by:
eobinna
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vinuth M. <vin...@gm...> - 2007-04-06 06:21:21
|
On 4/6/07, obi...@li... > Date: Fri, 30 Mar 2007 10:38:25 +0300 > From: Aleksi Kallio <ale...@cs...> > Subject: [Obix-framework-tipsandtricks] Deep copy of Configuration > To: obi...@li... > Message-ID: <460...@cs...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > Hello all, > > I have found this piece of code useful (see the end of message). I guess > achieving this is not possible using imports? > > If there is a more direct way of achieving the same result I'd like to > hear about. If not, something like this could be added to framework... > > > Best regards, > > -- > Aleksi Kallio, Application Architect, Scientific Software Development > P.O. BOX 405, 02101 Espoo, Finland, Tel +358 9 457 2297 > CSC is the Finnish IT center for science, www.csc.fi > e-mail: ale...@cs... > > > > **** > /** > * Do a deep copy (recursive copy of submodules) of source > Configuration content into target Configuration. > * @param source content to be copied, is not altered > * @param target Configuration to be written to > */ > private static void deepCopy(Configuration source, Configuration target) { > > // copy values > for (Object entry : source.values()) { > target.addEntry((ConfigurationEntry)entry); > } > > // recurse into modules > for (Object module : source.getModuleNames()) { > String moduleName = (String)module; > Configuration sourceModule = source.getModule(moduleName); > if (!target.containsModule(moduleName)) { > target.createConfiguration(moduleName); > } > deepCopy(sourceModule, target.getModule(moduleName)); > } > } I agree. I had want something like this for my project. It can be useful when we have multiple config files, which can hierarchically override values read from previous config files. Also useful when the client doesn't have to bother under which module a certain value is stored. So, having a flat structure even while maintained in multiple config files would be useful. But along with this deepCopy() function, a new kind of tag (maybe <configuration-include>) or an extra attribute to <configuration-import> tag, something like: <configuration-import import-type="deepCopy"> would be useful. |
From: Aleksi K. <ale...@cs...> - 2007-03-30 07:38:34
|
Hello all, I have found this piece of code useful (see the end of message). I guess achieving this is not possible using imports? If there is a more direct way of achieving the same result I'd like to hear about. If not, something like this could be added to framework... Best regards, -- Aleksi Kallio, Application Architect, Scientific Software Development P.O. BOX 405, 02101 Espoo, Finland, Tel +358 9 457 2297 CSC is the Finnish IT center for science, www.csc.fi e-mail: ale...@cs... **** /** * Do a deep copy (recursive copy of submodules) of source Configuration content into target Configuration. * @param source content to be copied, is not altered * @param target Configuration to be written to */ private static void deepCopy(Configuration source, Configuration target) { // copy values for (Object entry : source.values()) { target.addEntry((ConfigurationEntry)entry); } // recurse into modules for (Object module : source.getModuleNames()) { String moduleName = (String)module; Configuration sourceModule = source.getModule(moduleName); if (!target.containsModule(moduleName)) { target.createConfiguration(moduleName); } deepCopy(sourceModule, target.getModule(moduleName)); } } |
From: Keith K. <kei...@gm...> - 2006-05-21 18:00:30
|
Hi: I don't seem to find any emails on this mailing list. Is this product continue to be supported? Thanks, Keith |