Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Cannot modify resource set without a write transaction
[QVTO] Cannot modify resource set without a write transaction [message #657332] Wed, 02 March 2011 13:33 Go to next message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
Hi all!
I'm running a qvto transformation programmatically following the example transformation in http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava.

It worked fine until I changed the transformation to accepts an inout model and a in model (previously it was like the example an, in model and a out model)

When I execute it, it complains with the following error:
source=org.eclipse.m2m.qvt.oml.execution code=120 Unexpected runtime exception caught during execution data=[java.lang.IllegalStateException: Cannot modify resource set without a write transaction]

I tried to execute it inside a Command via the CommandStack.execute() but the error is still the same.

Is there a solution?
Re: [QVTO] Cannot modify resource set without a write transaction [message #657592 is a reply to message #657332] Thu, 03 March 2011 11:55 Go to previous messageGo to next message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
Since the in-place transformation (with an INOUT parameter) works well when I execute it directly from the Run menu, I tried to execute directly the code which is called via the QvtLaunchConfigurationDelegateBase class.

After some debugging I found that I need to declare my transformation in an extension point since when at some point the DeployedQvtModule.getModule() method is called (precisely at unitResolver.resolveDeployedUnitOnly(moduleID)) it raises an exception since my transformation is not found.

Unfortunately even if my transformation is stored in the BundleModuleRegistry the following conditions does not hold in anyway
public CFile resolveImport(String importedUnitName) {
		if(importedUnitName == null || importedUnitName.length() == 0) {
			return null;
		}
		
		IPath fullPath = new Path(importedUnitName.replace('.', '/') + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT);
		
		for (BundleModuleRegistry nextRegistry : bundleModules) {
			if (importedUnitName.indexOf(nextRegistry.getBundleSymbolicName()) == 1) {
				fullPath = new Path(importedUnitName.substring(nextRegistry.getBundleSymbolicName().length()+2));
			}
			else if (importedUnitName.startsWith("/")) { //$NON-NLS-1$
				fullPath = new Path(importedUnitName.substring(1).replace('.', '/') + MDAConstants.QVTO_FILE_EXTENSION_WITH_DOT);
			}
			if (nextRegistry.fileExists(fullPath)) {
				return new BundleFile(fullPath, nextRegistry);
			}
		}

		return resolveResourcePluginPath(importedUnitName);
	}


My importedUnitName is in the form
/bundleentry://1172.fwk5285449/transformations/my_transforma tion.qvto. I would match if was in the form /my_transformation.qvto, but it never can't be, no matter if I try to define the transformation with a different URI since it is instantiated correcly only if I pass a Platform URI in the following line of code:
QvtModule m = org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil.getQvtModule(transformationPlURI);


I there a salution? Perhasp it there a cleaner way to call an in-place QVT-o transformation in java?
Re: [QVTO] Cannot modify resource set without a write transaction [message #657625 is a reply to message #657592] Thu, 03 March 2011 14:05 Go to previous messageGo to next message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
With a dirty trick I managed to solve this problem, however after some computations the transformation complains again with the usual exception: Cannot modify resource set without a write transaction

I really don't know what I'm doing wrong Sad
Re: [QVTO] Cannot modify resource set without a write transaction [message #657826 is a reply to message #657625] Fri, 04 March 2011 09:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: koen.yskout.cs.kuleuven.be

Alex,

It looks like the model/resource on which you are trying to execute the
transformation is transactional (e.g., part of a transactional editing
domain). Are you feeding the transformation with a model from some
opened editor (GMF?) ?

This might explain while it works well with an in/out model: the
original (transactional) model is never modified.

I guess you need to obtain the (transactional) editing domain and create
a command that executes your transformation (see for example
http://wiki.eclipse.org/Graphical_Modeling_Framework/Tips#Cr eate_New_Elements_Using_RecordingCommand_and_CanonicalEditPo licies),
although you said in your initial post that you have tried this already...

If you do something else in the command than executing the
transformation (like changing the name of the model root or so), does
that work?

I'm sorry not to be of any more help,

Koen


On 03/03/11 15:05, --alex-- wrote:
> With a dirty trick I managed to solve this problem, however after some
> computations the transformation complains again with the usual
> exception: Cannot modify resource set without a write transaction
>
> I really don't know what I'm doing wrong :(
Re: [QVTO] Cannot modify resource set without a write transaction [message #657973 is a reply to message #657826] Fri, 04 March 2011 18:45 Go to previous message
--alex--  is currently offline --alex-- Friend
Messages: 26
Registered: October 2009
Junior Member
Thanks Koen!
I manage to solve the problem thanks to your suggestion.
I've created a new ResourceSet different from the one of editor and now the transformation works with the code from the example invocation!
Previous Topic:[ATL] Latest ATL Metamodel in KM3 Format
Next Topic:[QVTo] Is it possible to use blackbox libraries when running standalone?
Goto Forum:
  


Current Time: Fri Apr 19 19:34:21 GMT 2024

Powered by FUDForum. Page generated in 0.03203 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top