Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Transform qvto file standalone
Transform qvto file standalone [message #1469075] Tue, 11 November 2014 09:28 Go to next message
Lindung Manik is currently offline Lindung ManikFriend
Messages: 3
Registered: October 2014
Junior Member
Hi all,

I have this snippet:
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("qvto", new QvtOperationalResourceFactoryImpl());
			
QVTOperationalPackage.eINSTANCE.eClass();
			
// Refer to an existing transformation via URI
URI transformationURI = URI.createFileURI("Trad2Pivot.qvto");
		
// create executor for the given transformation
TransformationExecutor executor = new TransformationExecutor(transformationURI);
		
// define the transformation input
// Remark: we take the objects from a resource, however
// a list of arbitrary in-memory EObjects may be passed
ResourceSet resourceSet = new ResourceSetImpl();
Resource inResource = resourceSet.getResource(URI.createFileURI("ATransformation.qvto"), true);
EList<EObject> inObjects = inResource.getContents();
		
// create the input extent with its initial contents
ModelExtent input = new BasicModelExtent(inObjects);
// create an empty extent to catch the output
ModelExtent output = new BasicModelExtent();
		
// setup the execution environment details ->
// configuration properties, logger, monitor object etc.
ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true);
		
// run the transformation assigned to the executor with the given
// input and output and execution context -> ChangeTheWorld(in, out)
// Remark: variable arguments count is supported
ExecutionDiagnostic result = executor.execute(context, input, output);


The problems are:
1. Class org.eclipse.m2m.internal.qvt.oml.runtime.resource.QvtOperationalResourceFactoryImpl is hidden from the org.eclipse.m2m.qvt.oml.runtime.jar
2. Class org.eclipse.m2m.qvt.oml.ecore.QVTOperational.QVTOperationalPackage is not in plugin folder.

Do you have any better ideas?

Thanks.
Re: Transform qvto file standalone [message #1469209 is a reply to message #1469075] Tue, 11 November 2014 11:51 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
On 11/11/2014 09:28, Lindung Manik wrote:
> Hi all,
>
> I have this snippet:
>>
> Do you have any better ideas?
>
> Thanks.
Hi

Yes. Try a small complete program. It might work better or at least
might be intelligible to others.

Look for existing standalone examples on this thread, or perhaps

org.eclipse.ocl.examples.build.utilities.QVToTransformationExecutor

Regards

Ed Willink
Re: Transform qvto file standalone [message #1469271 is a reply to message #1469209] Tue, 11 November 2014 12:56 Go to previous messageGo to next message
Lindung Manik is currently offline Lindung ManikFriend
Messages: 3
Registered: October 2014
Junior Member
Hi Ed,

Basically, the snippet is working for standalone transformation in most cases. But the problem comes when I want to transform a qvto model.
In order to load a .qvto file a need to register the resource factory and the package.

Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("qvto", new QvtOperationalResourceFactoryImpl());
QVTOperationalPackage.eINSTANCE.eClass();


But, org.eclipse.m2m.internal.qvt.oml.runtime.resource.QvtOperationalResourceFactoryImpl is hidden from the org.eclipse.m2m.qvt.oml.runtime.jar.
And also org.eclipse.m2m.qvt.oml.ecore.QVTOperational.QVTOperationalPackage is not exported to plugin installation folder.
Re: Transform qvto file standalone [message #1469319 is a reply to message #1469271] Tue, 11 November 2014 13:47 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5395
Registered: July 2009
Senior Member
Hi

Repeating what is gibberish to me just wastes everyone's time.

https://wiki.eclipse.org/OCL/ForumNetiquette

Regards

Ed Willink


On 11/11/2014 12:56, Lindung Manik wrote:
> Hi Ed,
>
> Basically, the snippet is working for standalone transformation in most
> cases. But the problem comes when I want to transform a qvto model. In
> order to load a .qvto file a need to register the resource factory and
> the package.
>
>
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("qvto", new
> QvtOperationalResourceFactoryImpl());
> QVTOperationalPackage.eINSTANCE.eClass();
>
>
> But,
> org.eclipse.m2m.internal.qvt.oml.runtime.resource.QvtOperationalResourceFactoryImpl
> is hidden from the org.eclipse.m2m.qvt.oml.runtime.jar.
> And also
> org.eclipse.m2m.qvt.oml.ecore.QVTOperational.QVTOperationalPackage is
> not exported to plugin installation folder.
>
Previous Topic:Error while generating Diagram Editor Gen Model
Next Topic:Storing and loading .qvtox
Goto Forum:
  


Current Time: Sun Sep 24 06:59:28 GMT 2017

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

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