Model caching problem [message #872034] |
Tue, 15 May 2012 10:49 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Hello,
I have a caching problem when using EGL to generate code from a model. An old model version is used to generate the code.
I tracked it down to EmfModelResourceSet.java (in org.eclipse.epsilon.emc.emf). The resourceFactory is used to create a new resource
Resource result = resourceFactory.createResource(uri);
The createResource() method (org.eclipse.epsilon.emc.emf.EmfModelResourceFactory) checks if the resource is already available (which is the case) and returns this. But this is an old version of the model...
Am I doing something wrong, and should I tell some cache that the resource got updated (in my editor, eg after saving)? Do I need to manually clear the cache? Or should Epsilon forcefully clear the resource cache?
[Updated on: Wed, 16 May 2012 11:54] Report message to a moderator
|
|
|
|
Re: Model caching problem [message #872504 is a reply to message #872066] |
Wed, 16 May 2012 08:42 |
|
Maarten, thank you for your workaround . In any case, before we can decide if it's a bug in Epsilon or not, we'd need to know more about how the model transformation is being launched.
Are you really using EVL for generating code, and not EGL? EVL is intended for validation, not for model-to-text transformations :-/. Perhaps you meant EWL, the Epsilon Wizard Language?
|
|
|
Re: Model caching problem [message #872583 is a reply to message #872504] |
Wed, 16 May 2012 11:54 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Oops typo, I use EGL of course! (I'll change my first post as well)
Here is the code on how I execute my EGL template:
EglFileGeneratingTemplateFactory factory = createTemplateFactory();
factory.setTemplateRoot(myEGLTemplateURI.resolve(".").toString());
FrameStack frameStack = factory.getContext().getFrameStack();
// Declare some variables
frameStack.put(new Variable(VAR, value, EolNativeType.Instance));
// My workaround for this problem
org.eclipse.emf.common.util.URI file = org.eclipse.emf.common.util.URI.createURI(inputModel.toString());
EmfModelResourceFactory.getInstance().removeCachedResource(file);
File modelFile = new File(inputModel);
EmfModel emfModel = EmfModelFactory.getInstance().loadEmfModel("name", modelFile, getMetaModel());
factory.getContext().getModelRepository().addModel(emfModel);
EglTemplate template = factory.load(myEGLTemplateURI);
if (template.getParseProblems().size() > 0)
{
return template.getParseProblems();
}
template.process();
I left my workaround (disabling) for the Iterable/Iterate bug (see bug #379561) as it is kind of lengthy. It changes the ExecutorFactory/PointExecutor, so it should not influence this problem.
[Updated on: Thu, 24 May 2012 09:48] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.35528 seconds