Transform qvto file standalone [message #1469075] |
Tue, 11 November 2014 04:28  |
Eclipse User |
|
|
|
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 #1469319 is a reply to message #1469271] |
Tue, 11 November 2014 08:47  |
Eclipse User |
|
|
|
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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03343 seconds