Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Loading EMF models from a resource within some plugin
Loading EMF models from a resource within some plugin [message #561669] Tue, 11 November 2008 17:29
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Hi,

I'm trying to use the code below to load a model from an ecore file that
resides in another plugin. This gets me an
StringIndexOutOfBoundsException. What could I be doing wrong?

EmfModel core = new EmfModel();
StringProperties properties = new StringProperties();
properties.put(EmfModel.PROPERTY_NAME, "Core");
properties.put(EmfModel.PROPERTY_IS_METAMODEL_FILE_BASED, "false");
properties.put(EmfModel.PROPERTY_METAMODEL_URI, EcorePackage.eNS_URI);
properties.put(EmfModel.PROPERTY_MODEL_FILE, "bundleentry://678/resources/core.ecore");
properties.put(EmfModel.PROPERTY_READONLOAD, "true");
properties.put(EmfModel.PROPERTY_STOREONDISPOSAL, "false");
core.load(properties, ResourcesPlugin.getWorkspace().getRoot()
.getRawLocation().toPortableString());
module.getContext().getModelRepository().addModel(core);

Note, I have adjusted the URL passed to PROPERTY_MODEL_FILE to the value
it actually has at runtime. In my real code this is being computed using
FileLocator.find. The Exception is thrown in the load() call. The file
does exist and the plugin has set that directory to be part of the
binary build.

What is the correct way of doing this?

Regards,

Steffen

--
Dr. rer. nat. Steffen Zschaler
Senior Research Associate

Lancaster University
Lancaster, United Kingdom

Email szschaler@acm.org
WWW http://www.steffen-zschaler.de/

--

Consider submitting to QoSA 2009, the 5th International Conference on
the Quality of Software-Architectures.
http://qosa.ipd.uka.de/

Consider submitting to MiSE 2009, the 3rd International Workshop on
Models in Software Engineering
http://wikiserver.sse.cs.tu-bs.de/mise09
Previous Topic:InMemoryEmfModel without resource
Next Topic:Debugging ETL transformations
Goto Forum:
  


Current Time: Fri Apr 26 06:39:15 GMT 2024

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

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

Back to the top