Dear Markus,

why not using the plain old method EOModel.writeToFile() to write the model? In our application we make a lot of EOModel handling in memory (duplication, extension). The writing has only been needed for checking the initial implementation, therefore the conditional and simple error handling. There was no real work necessary to get the writing done ;-)


    /**
* help method, writes the model to the directory defined in the configuration. If nothing has * been defined, the model is not written at all but no error thrown. Even if the directory * isn't accessible or any other error occured only a warning is logged.
     *
     * @param model
     * @since 1.9 (04.03.2005)
     */
    public static void writeModel(EOModel model) {
        if (model == null) {
log.error("ModelHandler.writeModel() model to be written is null");
            return;
        }
        if (ModelHandler.eomodelWriteToFile) {
            try {
                File modelDir = new File(ModelHandler.dynamicModelPath);
                if (modelDir.exists() && modelDir.isDirectory()) {
model.writeToFile(ModelHandler.dynamicModelPath + model.name()); log.debug("ModelHandler.writeModel() model \"" + model.name() + "\" written to "
                              + ModelHandler.dynamicModelPath);
                }
                else {
log.error("ModelHandler.writeModel() modeldirectory does not exist: " + ModelHandler.dynamicModelPath);
                }
            }
            catch (Exception e) {
log.error("ModelHandler.writeModel() model could not be written: " + e); log.error("ModelHandler.writeModel() model name: " + model.name() + " dynamicModelPath: "
                          + ModelHandler.dynamicModelPath);
            }
        }
        else {
log.debug("ModelHandler.writeModel() no modeldirectory defined");
        }
    }

For reading EOModel we rely on the normal startup phase of the application. We have template models that are used for extension afterwards, so I cannot comment on the reading part.

Good luck,
Susanne

Message: 1
Date: Wed, 27 Sep 2017 09:03:31 +0200
From: Markus Ruggiero <mailingli...@kataputt.com>
To: "webobjects-dev@lists.apple.com" <webobjects-dev@lists.apple.com>
Subject: Reading EOModel files
Message-ID: <0498c47b-92ec-48de-800d-cb981fb59...@kataputt.com>
Content-Type: text/plain; charset=us-ascii

I am toying with the idea of writing a helper tool for EOModel. For this I need 
to read and write EOModel files. WOLips can do it, but as the source is not 
very easy to understand I simply ask here whether someone can point me to the 
relevant section in WOLips sources. Has anyone alreay done this and can share 
some code? It must not have any dependency on WO/Wonder stuff as the tool 
should be fully standalone.

Thanks for any help
---markus---


--
Susanne Schneider
Coordinator secuTrial® Development

interActive Systems GmbH
Glogauer Str. 19, D-10999 Berlin

fon    +49 30 22 50 50 - 498
fax    +49 30 22 50 50 - 451
mail   susanne.schnei...@interactive-systems.de
web    http://www.secuTrial.de

----------------------------------------------------
Geschäftsführer: Dr. Marko Reschke, Thomas Fritzsche
Sitz der Gesellschaft: Berlin
Amtsgericht Berlin Charlottenburg, HRB 106103B
----------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to