Model caching problem [message #872034] |
Tue, 15 May 2012 06:49  |
Eclipse User |
|
|
|
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 07:54] by Moderator
|
|
|
|
|
Re: Model caching problem [message #872583 is a reply to message #872504] |
Wed, 16 May 2012 07:54  |
Eclipse User |
|
|
|
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 05:48] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04998 seconds