|
Re: Loading model instances from different ecore projects [message #538761 is a reply to message #538753] |
Tue, 08 June 2010 14:58 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
is the Feature aisID part of the dimension model then? Can it be that in
the secon project the dimension model is not loaded or accessible, or
that the package dimensions is not registered?
Cheers
Jonas
Yvette wrote:
> Hello, I have two ecore models in two eclipse models/projects
> (Dimensions and DataStore). I added some src to load model instances by
> code in project in my Dimension project. This works quite well in the
> Dimension project and I am able to iterate my model elements, that I
> defined. In my DataStore model I refer to Ecore elements that were
> defined in the Dimension model.
> In the DataStore project I also added some Code to iterate DataStore
> instances. And I also called the code for iteration of Dimension in the
> Data Store project. But when it is started from DataStore project, the
> following exception is raised: (the aisId is my Id for all modeled
> elements)
>
> org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'aisId' not
> found. (file:/C:/Lib/ModelElements/ZeitNeu.automaisdimension, 2, 178)
> Exception in thread "main" java.lang.IndexOutOfBoundsException: Index:
> 0, Size: 0
> at java.util.ArrayList.RangeCheck(Unknown Source)
> at java.util.ArrayList.get(Unknown Source)
> at AutoMaisCubeStore.StoreCubeDimension(AutoMaisDataStore.java: 81)
> at AutoMaisCubeStore.main(AutoMaisDataStore.java:50)
>
>
> The question is: why is it possible to run the code from the Dimension
> model but not from the DataStore Model?
> Here is the code that I use to load Dimension instances
>
> AutoMaisDimensionPackage pack = AutoMaisDimensionPackage.eINSTANCE;
> ResourceSet rs = new ResourceSetImpl();
> rs.getResourceFactoryRegistry().getExtensionToFactoryMap().p ut
> ("automaisdimension", new XMIResourceFactoryImpl());
> URI fileURI = URI.createFileURI(new
> File(aFile.getAbsolutePath()).getAbsolutePath());
>
> Resource myPort = rs.getResource(fileURI, true); // <==
> cause exceptionight here
>
>
> Thanks!
> Yvette
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03749 seconds