Load an SCA composite model programmatically [message #574067] |
Wed, 04 February 2009 15:08 |
Eclipse User |
|
|
|
Hi all,
I'm trying to load an SCA model programmatically to get data form a
..composite file by navigating in the EMF objects instead of using a ugly
XPath resolver. I'm using SCA editor and metamodel v1.0.1
However, when using the classic EMF code to load a Resource:
// Create a resource set.
ResourceSet resourceSet = new ResourceSetImpl();
// Register the default resource factory -- only needed for
// stand-alone!
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION,
new XMIResourceFactoryImpl());
// Get the URI of the model file.
URI fileURI = URI.createFileURI(new
File(scaApp.getCompositeFile()).getAbsolutePath());
// Demand load the resource for this file.
Resource resource = resourceSet.getResource(fileURI, true);
Composite compositeModel = (Composite)resource.getContents().get(0);
on a composite file generated with the sca modeler (so conform to the
SCA metamodel), I got the following error:
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'composite' not
found.
(file:/home/mistria/runtime-EclipseApplication/test/default. composite,
2, 78)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2229)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.validateCreateObje ctFromFactory(XMLHandler.java:2220)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType (XMLHandler.java:1318)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XM LHandler.java:1454)
at
org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1019)
at
org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:83)
....
When looking at variables when the exception is raised, it seems like
the ScaFactory is found and used to unserialize model (a good point!)...
Do you have any idea of why this ScaFactory cannot resolve "composite"???
Regards,
Mickael
|
|
|
Powered by
FUDForum. Page generated in 0.03260 seconds