Mailing List webobjects-dev@wocommunity.org Message #436
From: Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch>
Subject: Re: [WO-DEV] Load additional D2W models?
Date: Sat, 11 Mar 2023 11:26:40 -0500
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Signed Data (Text SHA256)
Well, here are my observations so far:

Added code to Application.main() right before the call to ERXApplication.main() to read in the d2wmodel files. Works well and I can create a suitable property which I then push with System.setProperty().

However it seems that when Wonder is initializing that property gets reset to the default. Whatever I specify in the Properties file will be used, no matter what I push into System properties. Thus I assume the ERXProperty code (or something related) reloads all the properties from the Properties and Properties.dev/.prod and Properties.ruggiero files zapping my carefully built property. I did not have time to investigate further (what about defining the property on the command line? Will that get zapped, too?). So for the time being I edit my Properties file manually which seems to work and that value is used. Maybe when I find some free time (anyone having some for salešŸ˜‡?) I might start to dive deeper into that particular part of Wonder.

Oh the Wonders of Wonder

---markus---

PS 
Why did it "seem to workā€? 
I had a stray definition for that property already in the global Properties file. I realized my error when I started to add more d2wmodel files and my code worked but the model files did not make it, only the first 5 entries were picked up (which where the ones set in the Properties file). It took me a moment to figure what was going on.

Morale of this story: "Never assume something works just because it does!"


On 24 Feb 2023, at 22:50, Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch> wrote:

Hi Ramsey,

was think in the same lines. Started a test in main() right before calling EXRApplication.main(). Seems to work in dev mode. Will test in prod. Unfortunately (well, no really) Iā€™ll be on vacation so I can only finish my work when Iā€™m back. Will report here.

JĆ¼rgen,

That method was my entry point into searching for a solution. But this requires to dabble with the Wonder code itself which I dit not want to do, at least not for a start. Might get back to it after my vacation.

Thanks all that responded. Even if someone cannot provide an out-of-the-box solution discussing things here is extremely valuable.
---markus---


On 22 Feb 2023, at 20:22, Ramsey Gurley <Ramsey.Gurley@practicemojo.com> wrote:

Have you tried scanning for your additional model names in a static{} block in your application class? That should happen very early and seems like it should have enough access to the classpath to find everything. I never really used additional model names and just used the d2w.d2wmodel/user.d2wmodel files.


From: WebObjects & WOnder Development on behalf of Markus Ruggiero (rucotec)
Sent: Thursday, February 23, 2023 4:58 AM
To: WebObjects & WOnder Development
Subject: [WO-DEV] Re: Load additional D2W models?

Please tick
[  ] Nobody knows anything
[  ] Nobody ever had such an idea and does not care
[  ] Nobody out there anymore

On 21 Feb 2023, at 15:38, Markus Ruggiero (rucotec) <markus.ruggiero@rucotec.ch> wrote:

I found this property ā€œer.directtoweb.ERD2WModel.additionalModelNamesā€ that can be use to load additional D2W model files. I want to make this property dynamic so that its list of model names is built from a directory scan of the resources folder (or a subfolder) and all models found are loaded. This would allow to have models built around some grouping criteria like e.g. per entity without having to manually maintain the list of names in the properties file. I am in a prototype phase where I play extensively with a rather extensive EOModel, adding and removing entities. Such functionality would be great to have.

Anyone done something like this? When during app startup would be a good time to build this list? I think it must be done before D2W is initialized. Probably application.run() right before calling super.run() might already be too late?

Open for any tip, idea, help, code snippets, whatever.
Thanks a lot

---markus---





Markus Ruggiero

rucotec GmbH                        web https://rucotec.ch
Leonhardsberg 1                   email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701









Confidentiality Notice: This email, including all attachments and replies thereto, are covered by the Electronic Communications Privacy Act, 18 U.S.C. Sections 2510-2521 and are legally privileged. This information is confidential, and intended only for the use of the individuals or entities named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this transmitted information is strictly prohibited. Please notify us if you have received this transmission in error. Thank you.




Markus Ruggiero

rucotec GmbH                        web https://rucotec.ch
Leonhardsberg 1                   email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701










Markus Ruggiero


rucotec GmbH                        web https://rucotec.ch
Leonhardsberg 1                   email markus.ruggiero@rucotec.ch
4051 Basel / Switzerland         mobile +41 79 508 4701








Content Unaltered as verified By:
<markus.ruggiero@rucotec.ch>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster