Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Loading model instances from different ecore projects
Loading model instances from different ecore projects [message #538753] Tue, 08 June 2010 14:48 Go to next message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
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().put
			("automaisdimension", new XMIResourceFactoryImpl());
	 		URI fileURI = URI.createFileURI(new File(aFile.getAbsolutePath()).getAbsolutePath());
			
	 		Resource myPort = rs.getResource(fileURI, true); // <== cause exceptionight here


Thanks!
Yvette
Re: Loading model instances from different ecore projects [message #538761 is a reply to message #538753] Tue, 08 June 2010 14:58 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
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
Re: Loading model instances from different ecore projects [message #538766 is a reply to message #538761] Tue, 08 June 2010 15:17 Go to previous messageGo to next message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
The Feature aisID part of the dimension model. I thought the second model will by loaded by its one code. But what I did in my second project to load the dimension model
AutoMaisDimensionPackage test = AutoMaisDimensionPackage.eINSTANCE;

What Do you mean with registered?
Thanks
Yvette
Re: Loading model instances from different ecore projects [message #538776 is a reply to message #538753] Tue, 08 June 2010 15:30 Go to previous message
Yvette is currently offline YvetteFriend
Messages: 13
Registered: May 2010
Junior Member
I found out! I have to say that I started developing java again only a few weeks ago.

The cause of my error was, that I had the wrong version of generated Dimension source code in my dataStore model, And in this the id was not defined,
So thanks again
Previous Topic:Add EContentAdapter
Next Topic:ImportManager from GenModelImpl is null, but marked @Deprecated ???
Goto Forum:
  


Current Time: Thu Apr 25 14:45:49 GMT 2024

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

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

Back to the top